Jump to content

Problem - ftp_put() returns FALSE


jayesch

Recommended Posts

Hello,

 

I see this weird problem with ftp_put. I have checked for all common sources of errors and find that none of them apply for my case.

 

1) I can do ftp_chdir() to destination directory with success

2) I have write access the the destination directory.

3) I can upload files to FTP server from windows command prompt or other FTP clients.

4) File source path has no spaces in it(C:\test.txt)

 

 

Unfortunately I do not have access to FTP server logs. FTP server is hosted on a MAC machine with OS-X 10.0

 

Here is the code snippet =

 

  1. 

  2. $ftp_user_name='user';

  3. $ftp_user_pass='password';

  4. $ftp_server='somehost';

  5. $destination_file='test.txt';

  6. $src_file='c:\test.txt';

  7. 

  8. $conn_id = ftp_connect($ftp_server);

  9. $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

  10. if(!ftp_chdir($conn_id,'/Documents/MobileMedia/site/uploads/video/mpeg'))

  11. {       

  12.  echo "No read permission in the destination directory </br>";

  13. }     

  14. if(!ftp_put($conn_id, $destination_file, $src_file, FTP_BINARY))

  15. {

  16.  echo "Upload operation to FTP server failed </br>";

  17. } 

  18. ftp_close($conn_id);

  19. 

 

 

 

Let me know if there is anything wrong or there exists any other source of error.

 

Thanks

Jayesh Sharma

Link to comment
https://forums.phpfreaks.com/topic/125314-problem-ftp_put-returns-false/
Share on other sites

It fails still. My code initially had complete path in the ftp_put(). So to narrow down the problem I did a ftp_chdir() as an additional step. Also I have made doubly sure that I do have write permissions to the destination directory.

 

 

HOST:/Library/WebServer/Documents/MobileMedia/site/uploads/video USER$ ls -l

total 0

drwxrwxrwx + 6 USER  admin  204 Sep 21 22:49 mpeg

 

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.