|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-02-07 15:26 UTC] afuzaylov at mlgpro dot com
Description:
------------
Hi. I have created a small php file to FTP .swf files to another server. It seems to run very very slow compared to another FTP program. It takes filezilla 1.5 minutes to upload 31MB .swf file, while it takes PHP to upload it about 3 hours.
I am running on windows xp apache2, PHP 5.2.
Reproduce code:
---------------
function ftp($file_name) {
$conn_id = ftp_connect(FTP_SERVER);
$login_result = ftp_login($conn_id, FTP_USERNAME, FTP_PASSWORD);
if ($conn_id && $login_result) {
set_time_limit(60 * 60 * 4); // 4 hours from now
$upload = ftp_put($conn_id, FTP_PATH . $file_name, DIRECTORY_DESTINATION . $file_name, FTP_BINARY);
}
ftp_close($conn_id);
if ($upload) { return TRUE; }
return FALSE;
}
$file_name = "test.swf";
$uploaded = ftp($file_name);
if ($uploaded) {
// do something
} else {
// do something
}
}
Expected result:
----------------
It should not take 3 hours to upload a file while it takes other FTP programs less than 2 minutes.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 25 16:00:02 2025 UTC |
Oops, I'm sorry, I forgot to define constants. Please put the following code on the second line of the code I just submitted above (right after <?php) define('FTP_SERVER', ''); define('FTP_USERNAME', ''); define('FTP_PASSWORD', ''); define('FTP_PATH', ''); // where to put your file on the server define('DIRECTORY_DESTINATION', ''); // where your file is currently located on your local machine