Jump to content

Use sleep() for large uploads


deansatch

Recommended Posts

integrate php ftp. I have never done it because i dont need it

 

I looked into php ftp and from what I can gather, you can't "UPLOAD" via php ftp, you can upload via http (hence my post) then use ftp to transfer it from one server to another (rendering it a pretty useless function in my eyes).

Link to comment
Share on other sites

Your php script that is the target of the upload form is not executed until after the file has been completely uploaded. The act of receiving the uploaded file is handled by the web server and is basically out of your control (except for what you can influence by stetting some of the php settings), unless you do something to cause the normal handling of the upload to be replaced with your own code. See this thread for how you could do something like that -  http://www.phpfreaks.com/forums/index.php/topic,284122.0.html

Link to comment
Share on other sites

I haven't actually got a problem, I am working something out in theory before starting a script to get the best way to do it - i.e. huge file uploads via a browser.

 

I suggested sleep() as it is something I came across and wondered if a)it would help this and b)what is its uses?

Link to comment
Share on other sites

The only use I can imagine for sleep() is if you are limited to say 1000 emails per hour and you have written a mailing script with more than 1000 recipients you would mail 1000 then slepp() for an hour then mail another 1000 etc... But wouldn't that mean your browser would be open for hours and timeouts would still occur?

Link to comment
Share on other sites

The only use I can imagine for sleep() is if you are limited to say 1000 emails per hour and you have written a mailing script with more than 1000 recipients you would mail 1000 then slepp() for an hour then mail another 1000 etc... But wouldn't that mean your browser would be open for hours and timeouts would still occur?

 

No, It'd be recommended to sleep for example 10ms between execution of mail() to guard against problems, another use of sleep() can be to delay execution of a set of commands, such as

 

$fp = fopen('?doCronjob', 'r')

sleep(1000); //Wait for reply

file_get_contents(/usr/var/cronlog.log);

 

 

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.