View Full Version : Resolved PHP script to start download after specific time
04-21-2012, 01:57 AM
I am working on file hosting project like Hotfile. I have faced a very big problem that is I do not know how to start download after given specific time. I know how to do this with Java Script but my client do not accept that
please help me on this matter
Thank you in advance
04-21-2012, 02:05 AM
I do not know how to start download after given specific time.
Can you clarify this a bit?
Do you want the client to connect but not receive any file data until a certain time? (EG there is a connection but nothing is sent)
Do you want to initiate a download at a certain time? (Not possible - html is stateless so the client would need to keep re-trying)
Do you just want the link to the download to be available only at a certain time? (Easy but users can still use a direct link)
04-21-2012, 02:13 AM
So it sounds to me that you want to have a user visit a page and then, after a brief countdown, the file begins download. Is this correct?
Otherwise, there are some workarounds you can use.
PHP with IFRAMES: This would be a super hacked approach in my opinion. Have your normal download page. Then have an IFRAME on that page which uses PHP's sleep function:
sleep( 5 ); // Sleeps for 5 seconds
Then, after your page loads, the IFRAME will load your download page. The download page will take 5 seconds to load, and then show whatever content you desire.
Flash: Have a flash client execute the download. Flash can, using ActionScript, delay the download. Having said this, I really wouldn't recommend a download site that depends on Adobe Flash.
04-21-2012, 02:26 AM
thank you very much tangoforce and ShaneC. yes I need to have a user visit a page and then, after a brief countdown, the file begins download.
I think Sleep() will be useful in this case while displaying GIF which has count down.
I found my way by your instructions.
04-21-2012, 02:34 AM
Glad we could help! I've marked your thread as Resolved. Please let us know if you encounter any more difficulty!
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.