|  | Posted by chris.g.wood on 07/03/06 23:17 
laredotornado@zipmail.com wrote:> Hi,
 >
 > I'm using PHP 4.3.  There is a section of my application in which I'd
 > like users to be able to download a custom file.  The file would be
 > different for each user, so I was planning on creating it on the fly
 > when they click "Download".  However, I would like to delete the file
 > from the server a certain period of time after they've downloaded it.
 > (It's a 3 or 4K file).  How can I do this?
 >
 > Thanks,  - Dave
 
 Think a few have pointed this out, but you don't need to store the
 file, something like:
 
 header('Content-Type: text/html');
 header('Content-Length:' . filesize(........));
 header('Content-Disposition: attachment; filename="..........."');
 // Display what you want to output
 print "Something, Or, Other, just testing, the way this works";
 // Output a new line else everything is all on one line.
 print "\n";
 print "www.whatever.co.uk";
 print "\n";
 
 
 Obviously the script can be changed for each user using a little php.
 
 I've a collection of useful scripts on a site I put together (nothing
 major, just slowly collecting together things i've written over the
 years).
 http://www.opanoid.co.uk/phphelp/
 
 C Wood.
  Navigation: [Reply to this message] |