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).

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

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?

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?

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);

 

 

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.