Page 1 of 1

File copy/FTP accross the internet

Posted: Mon Nov 11, 2002 5:03 pm
by Fari
Hi guys .. a dilemma of mine:

The below script is running on a webserver. The idea is that a 'blob' type holds a file name and this file has to be moved from the PC where the page is viewed accross the internet to a folder on the web server.

However right now the webserver is looking for the original file in a folder ON THE WEBSERVER instead of on the machine where the page is viewed?? I tried FTP - ing but for that I'd need an FTP server running on the machine where the file to be transferred is.. agree?? and it's not always possible... so how do I get the selected file over onto the webserver???

Please!!!!!!! ta - fari

Code: Select all

if (mysql_field_type( $result , $i ) == "blob" )
    {
	  $source_file_name = $new_stuffї$i];
	  $temp = substr ( strrchr($new_stuffї$i] , "&quote;),1);
	  $dest_file_name = "../images/" . $temp; 
	  $new_stuffї$i] = $dest_file_name;  
		if (!(copy($source_file_name , $dest_file_name)))
		  {
		   echo"<TR><TD></TD><TD>";
		   arial_2("Could not copy file!");
		   echo"</TD></TR>";
          &#125;
		else 
		  &#123;
		   echo"<TR><TD></TD><TD>";
		   arial_2("File copied successfully!");
		   echo"</TD></TR>";
          &#125;	  
		  
  	&#125;

Posted: Mon Nov 11, 2002 5:10 pm
by volka
please read Sticky: Before Post Read: Frames, JavaScript, and PHP Overview
The php script is running server-side and has (hopefully) no access to the client's filesystem. The client has to upload the file.
Read 18. Handling file uploads in the online manual to learn more about this.

Hi Volka..

Posted: Mon Nov 11, 2002 5:30 pm
by Fari
.. I tried that way but couldn't only get a truncated version of the file ... dunno why .. anyways .. will try again!

Posted: Mon Nov 11, 2002 5:32 pm
by volka
note
Related Configurations Note: See also the file_uploads, upload_max_filesize, upload_tmp_dir, and post_max_size directives in php.ini
at http://www.php.net/manual/en/features.file-upload.php