Hi,
I have used the following code to upload a file from my local machine to the web server. It works ok as it uploads the file but is very slow even with small files. The strange thing is that it displays the error message even though the file has been uploaded. I thought maybe this might be why it is so slow. Could anybody help me.
Thanks
This is the error message
Warning: ftp_put() [function.ftp-put]: PORT command successful in c:\program files\apache group\apache\htdocs\bk\ftp_test.php on line 16
There was a problem while uploading file.txt
This is the code:
$user = "username";
$pass = "password";
$ftp = "ftp.myFTPpath.com";
$file = 'file.txt';
// open some file for reading
$fp = fopen($file, 'r');
$conn_id = ftp_connect($ftp);
// login with username and password
$login_result = ftp_login($conn_id, $user, $pass);
// try to upload $file
if (ftp_put($conn_id, $file, $file, FTP_ASCII))
{
echo "Successfully uploaded $file\n";
} else {
echo "There was a problem while uploading $file\n";
}