Paulio Posted February 20, 2012 Share Posted February 20, 2012 Hi, I have created a script that connects to an FTP SERVER... downloads a movie file to the web server then uploads it to a target FTP server. If I move a small file of say 10mb it works well! But if I move a larger moviefile such as a 700mb file it doesn't... The only thing I can think is there is some sort of timeout... Any pointers would be a massive help! I have tried to increase the FTP timeout and also enabled passive mode ftp_set_option($conn2, FTP_TIMEOUT_SEC, 600); <?php $movefile = "movie 2.avi"; $server1 = array( "Name" =>"Downloads", "Host" =>"10.0.1.3", "User" =>"Paulio", "Pass" =>"lol", "Path" =>"/Download/Completed"); $server2 = array( "Name" =>"files", "Host" =>"10.0.1.2", "User" =>"Paulio", "Pass" =>"lol", "Path" =>"/Television"); ////////////////////////////////// Download file to be moved. ////////////////////////////////// // Connect to server $conn1 = ftp_connect($server1['Host']); // Open a session to an external ftp site $login1 = ftp_login ($conn1, $server1['User'], $server1['Pass']); ftp_pasv($conn1, true); // Check open if ((!$conn1) || (!$login1)) { echo "Ftp-connect failed!"; die; } else { echo "Connected to " . $server1['Name'] . " FTP server.<br><br>"; } [b]ftp_set_option($conn1, FTP_TIMEOUT_SEC, 600);[/b] ftp_chdir($conn1, $server1["Path"]); // Moves file to be moved to web NAS drive. ftp_get($conn1, $movefile, $movefile, FTP_BINARY); ////////////////////////////////// Upload file to be moved. ////////////////////////////////// // Connect to server $conn2 = ftp_connect($server2['Host']); // Open a session to an external ftp site $login2 = ftp_login ($conn2, $server2['User'], $server2['Pass']); ftp_pasv($conn2, true); // Check open if ((!$conn2) || (!$login2)) { echo "Ftp-connect failed!"; die; } else { echo "Connected to " . $server2['Name'] . " FTP server.<br><br>"; } [b]ftp_set_option($conn2, FTP_TIMEOUT_SEC, 600);[/b] ftp_chdir($conn2, $server2["Path"]); // Uploads moved file from web NAS drive to destination ftp_put($conn2, $movefile, $movefile, FTP_BINARY); //Deletes source file ftp_delete($conn1, $movefile); //Deletes temp file unlink($movefile); ftp_close($conn1); ftp_close($conn2); echo "Complete."; ?> Thanks, Paul. Quote Link to comment https://forums.phpfreaks.com/topic/257385-ftp-move-from-one-server-to-another-timeout/ Share on other sites More sharing options...
Rifts Posted February 20, 2012 Share Posted February 20, 2012 try downloading the video, zipping it, uploading it, unzipping it on the server. Quote Link to comment https://forums.phpfreaks.com/topic/257385-ftp-move-from-one-server-to-another-timeout/#findComment-1319237 Share on other sites More sharing options...
Paulio Posted February 20, 2012 Author Share Posted February 20, 2012 I can't download the file to the web server. This is the stage that times out. Quote Link to comment https://forums.phpfreaks.com/topic/257385-ftp-move-from-one-server-to-another-timeout/#findComment-1319273 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.