I'm having trouble with ftp_put. My code is below (with the password changed obviously.
It all works, it allows me to change directories, it will list files in each directory but it wont let me upload files. Other functions work but not ftp_put. I can upload them manually fine so the user does have permission, but can't get it to work with a php script.
I have tried both FTP_ASCII and FTP_BINARY, no luck with either. Any help would be appreciated.
Adam
<?
$host="cpsa.org.au";
$user="cpsa";
$pass="password";
$target="cpsa.org.au/root";
$source = "C:\Documents and Settings\adamb\My Documents\My Pictures\2006-10-25\Image0001.txt";
$fileName = "Image0001.txt";
$conn = ftp_connect($host) or die ("Cannot initiate connection to host");
ftp_login($conn, $user, $pass) or die("Cannot login");
echo ftp_pwd($conn) . "<br />";
echo ftp_chdir($conn,$target);
echo ftp_pwd($conn) . "<br />";
echo ftp_put($conn,$filename,$source,FTP_ASCII);
ftp_close($conn);
?>
It all works, it allows me to change directories, it will list files in each directory but it wont let me upload files. Other functions work but not ftp_put. I can upload them manually fine so the user does have permission, but can't get it to work with a php script.
I have tried both FTP_ASCII and FTP_BINARY, no luck with either. Any help would be appreciated.
Adam
<?
$host="cpsa.org.au";
$user="cpsa";
$pass="password";
$target="cpsa.org.au/root";
$source = "C:\Documents and Settings\adamb\My Documents\My Pictures\2006-10-25\Image0001.txt";
$fileName = "Image0001.txt";
$conn = ftp_connect($host) or die ("Cannot initiate connection to host");
ftp_login($conn, $user, $pass) or die("Cannot login");
echo ftp_pwd($conn) . "<br />";
echo ftp_chdir($conn,$target);
echo ftp_pwd($conn) . "<br />";
echo ftp_put($conn,$filename,$source,FTP_ASCII);
ftp_close($conn);
?>