Download check - take 2

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
daven
Forum Contributor
Posts: 332
Joined: Tue Dec 17, 2002 1:29 pm
Location: Gaithersburg, MD
Contact:

Download check - take 2

Post by daven »

To clarify/reiterate a previous question I had:

Scenario: User clicks link to binary file, and chooses "save". After the file is downloaded, I need to have the server's copy deleted. Thus, I need some way to check to see if the user has downloaded the file.

I am running under FreeBSD, so COM objects are not available.

Any suggestions would be greatly appreciated. I am against a wall.
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post by Gen-ik »

Why don't you just log the time of the download started and then delete the file from your server 1, 2, or even 12 hours later... depending on the size of the file.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

why do you create the file and keep it anyway?
e.g.

Code: Select all

<?php
header('Content-type: text/plain');
header('Content-disposition: attachment; filename=sqrts.txt');
$arr=range(0,10);
$arr=array_map('sqrt', $arr);
print_r($arr);
?>
or

Code: Select all

<?php
header('Content-type: application/octet');
header('Content-disposition: attachment; filename=dirlist.txt');
passthru('ls -lad *');
?>
if you have to invoke an external programm
Post Reply