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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.