|
Posted by kick ass on 03/13/07 15:36
Thanks,
What you are saying makes sense to me.
I will shortly explain what I am trying to do:
On my page all users have they own username and password.
When I translate some document, I upload that document into specific users
'mailbox' on my website. So when user logs in, he can see the list of files
I uploaded for him and he can download them.
I will not attempt to delete file after download any more, as you said, it's
not a good idea.
Now, since I keep tracking changes that user makes in my database (i.e. when
I upload file, it is recorded in database), I would like to do the tracking
of downloaded files.
So when user downloads the file, I would like the php script to insert that
record into database
(i.e. RECORD_NO:216, USER: some_user, DATE OF DOWNLOAD:13.03.2007.,
FILE_DOWNLOADED: some_filename).
In that way, I could visit my website once a week and even manualy delete
files that user "took away" to his computer.
Is this possible to do in some way, or is it too complicated?
Thanks for your efforts
"Steve" <no.one@example.com> wrote in message
news:ENyJh.23$Ik4.5@newsfe06.lga...
>
> "kick ass" <pub_lander@yahoo.com> wrote in message
> news:et613g$a67$1@news1.carnet.hr...
> | Hi,
> | this is my question:
> | I have a link to some file (file.zip) on my page.
> | I would like that this file is automaticaly deleted from server after
> user
> | downloads it.
> |
> | So, user clicks right mouse button, chooses "Save target as..." and than
> | saves it.
> | How to make script that deletes file from server after it's been
> | downloaded??.
> |
> | I'm out of ideas..
> | Thanks for any help (the simple, the better :)
>
> please explain what you are trying to accomplish. this is bad news
> architecturally! your user is going to be pissed when he gets corrupt or
> partial data caused by transport anomolies (i.e. network). your server
> would
> have deleted the file and your user has no recourse...it's gone.
>
> what i'd recommend (without knowing any of your intentions), is to set an
> expiration on a file. when the user 'gets' the file, php sets an
> expiration
> date on the file on the server. you either have a windows scheduled task
> or
> a cron execute a php script that kills off all expired files...run it as
> frequently as you see fit.
>
> that would allow for shitty downloads to be attempted again and doesn't
> place any responsibility on the end-user to manage (i.e. delete from your
> server) the file(s) they are working with.
>
> i use the following code to serve up downloadable files. you'd point your
> href's to this script, giving the name of the file to retreive as an arg
> to
> the query string. you would only have to place a line or two of code in
> this
> script to update a db (or similar mechanism) with the file name/path and
> its
> expiration. hth:
>
> <?
> require_once 'site.cfg.php';
> $fileData = '';
> $fileName = $_REQUEST['fileName'];
> $filePath = $site->uploadBaseDirectory;
> if ($fileName != ''){ $fileData = @file_get_contents($filePath .
> $fileName); }
> header('pragma:
> );
> header('expires:
> );
> header('cache-control: private',
> );
> header('cache-control: must-revalidate, post-check=0,
> ck=0' );
> header('content-disposition: attachment; filename="' . $fileName .
> );
> header('content-size: ' .
> );
> header('content-transfer-encoding:
> );
> header('content-type:
> );
> echo $fileData;
> ?>
>
>
Navigation:
[Reply to this message]
|