Page 1 of 1

Problem - ftp_put() returns FALSE

Posted: Mon Sep 22, 2008 2:29 am
by jayesch
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 =

Code: Select all

 
$ftp_user_name='user';
$ftp_user_pass='password';
$ftp_server='somehost';
$destination_file='test.txt';
$src_file='c:\test.txt';
 
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if(!ftp_chdir($conn_id,'/Documents/MobileMedia/site/uploads/video/mpeg'))
{         
  echo "No read permission in the destination directory </br>";
}       
if(!ftp_put($conn_id, $destination_file, $src_file, FTP_BINARY))
{
  echo "Upload operation to FTP server failed </br>";
}   
ftp_close($conn_id);
 
Let me know if there is anything wrong or there exists any other source of error.

Re: Problem - ftp_put() returns FALSE

Posted: Tue Dec 09, 2008 6:01 pm
by jahwobbler
jayesch wrote: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 =

Code: Select all

 
$ftp_user_name='user';
$ftp_user_pass='password';
$ftp_server='somehost';
$destination_file='test.txt';
$src_file='c:\test.txt';
 
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
if(!ftp_chdir($conn_id,'/Documents/MobileMedia/site/uploads/video/mpeg'))
{         
  echo "No read permission in the destination directory </br>";
}       
if(!ftp_put($conn_id, $destination_file, $src_file, FTP_BINARY))
{
  echo "Upload operation to FTP server failed </br>";
}   
ftp_close($conn_id);
 
Let me know if there is anything wrong or there exists any other source of error.