Re: File downloads

From: Date: Thu, 08 Jun 2006 07:47:09 +0000
Subject: Re: File downloads
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-237592@lists.php.net to get a copy of this message
Thanks to Tedd, Barry, George and others for help over "download file" problem. I'm going to receive an ACK if the file downloads correctly. In absence of such an ACK, a script would quitely remove the temporary files after a fixed interval of time. Temporary files have unique filenames. New problem: Is there a way for the server to notify the client that a new file has become available for download, provided the client was online in the past X minutes? This could be done if 1. The client queries the server after a set interval of time. I DO NOT WANT THIS FOR SOME SILLY REASON. 2. The connection is kept alive (?). With my current knowledge of PHP, I am not able to manage this. Cookies or sessions? Can't find a related example directly dealing with this issue. All wild ideas/links/examples are welcome. What changes would be required in Apache conf file (if any)? Thanks & Regards KM On 6/7/06, tedd <tedd@sperling.com> wrote:
At 8:42 AM +0000 6/7/06, kartikay malhotra wrote: Dear All, I have a HTTP server + MySQL database. Everytime a file is requested for download, my PHP script loads the content from the database into a temporary file (on the server). I then pass a URL to the client, with a link to this file. The client can thus download the file at any time. However, I can foresee many problems with this approach. One is, when to delete the temporary file? Also with more than one client, this approach would have to be refined. Security is also an issue: One user may read another's files. Can anyone kindly give me an alternative approach? I reiterate, I cannot supply static URLs as the downloadable file is generated on-demand. Thanks & Regards KM KM: Thinking off the top of my head (not always the best for me) -- why not give the user a static url AND a key? The static url would have a php program sitting there waiting for a user to come along and provide the correct key. After which, your program would then create the file (in a random named folder); provide the user with a link; and clean-up after he's done. That way you have the control over what's happening. The key approach handles security and when to clean-up. hth's tedd -- ------------------------------------------------------------------------------------ http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#237592) next »