Jump to content

Problem with PHP and FTP_PUT command


egorig

Recommended Posts

Hi everyone,

 

in index.php i'm calling a function this way :

Uploading Archived Filename <?php upload_to_server($archive_filename);?> : <b>Done</b> <br/>

 

here's the function upload_to_server()

[pre]

function upload_to_server($fname)

{

$ftp = ftp_connect(FTP_SERVER) or die('Could not connect to FTP');

@ftp_login($ftp,FTP_USERNAME,FTP_PASSWORD) or die('Wrong username or password!');

ftp_put($ftp, $fname, $fname, FTP_BINARY) or die('Error while uploading file to the server');

ftp_close($ftp);

}

[/pre]

 

The page says "Transfering .." till one time and then it says Done (in Firefox). But the file is still uploading (i'm checking that with FTP Client and on Refresh it changes its size) and the message <b>Done</b> is not displayed , so the other part of the page (footer ..).

 

I tried this :

set_time_limit(0);

ftp_nb_put();

ftp_set_option($ftp, FTP_TIMEOUT_SEC, 10000);

return true (at the end of the function)

but they don't help. Can anyone tell me why is this happening ?

 

Thanx in advance!

Link to comment
https://forums.phpfreaks.com/topic/93837-problem-with-php-and-ftp_put-command/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.