Jump to content

Uploading a file via FTP


robcrozier

Recommended Posts

Hi everyone, what i'm trying to do is allow a user to upload a file to the server via FTP using PHP.  I have chosen to do it this way so that the file permissions are not set to apache when the file is uploaded, instead they will be set to me (the owner) so that they can be remotely opened etc later on.

 

Here's what i have so far:

$ftp_server = "******"; 
$ftp_user_name = "******"; 
$ftp_user_pass = "******"; 
$conn_id = ftp_connect($ftp_server); 
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

ftp_put($conn_id, $target, $_FILES['file']['tmp_name'], FTP_BINARY);

 

However i keep getting this error message:

 

ftp_put() [function.ftp-put]: path/to/file/name.jpg: No such file or directory in path/to/php/file on line 91

 

Can anyone help?

 

Cheers

 

 

Link to comment
https://forums.phpfreaks.com/topic/130594-uploading-a-file-via-ftp/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.