auto delete file after download
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 :)
Re: auto delete file after download
kick ass wrote:
> 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??
If using php, you add a form+button at the page which the user has to
press after the download has finished, this as php don't have magical
powers to see when someone finished the download.
--
//Aho
Re: auto delete file after download
Yes I know that ;)
But it's kind a stupid to ask user to delete it for you.
Maybe if I make a form + button which when pressed starts an FTP download on
to users computer and then I can check if the FTP_GET is completed. Then the
php script deletes
that file from server.
But then, my problem would be how to invoke "menu" which gives user the
choice to
select destination on his computer for file to download (similar to the
"Save Target As..." in IE).
Any ideas??
"J.O. Aho" <user [at] example.net> wrote in message
news:55nhv3F264a1nU1 [at] mid.individual.net...
> kick ass wrote:
>> 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??
>
> If using php, you add a form+button at the page which the user has to
> press after the download has finished, this as php don't have magical
> powers to see when someone finished the download.
>
> --
>
> //Aho
Re: auto delete file after download
kick ass wrote:
> 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??
You can never know for sure the file has been downloaded.
--
Richard.
Re: auto delete file after download
"kick ass" <pub_lander [at] yahoo.com> wrote in message
news:et613g$a67$1 [at] 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 = [at] file_get_contents($filePath .
$fileName); }
header('pragma: public' );
header('expires: 0' );
header('cache-control: private', false );
header('cache-control: must-revalidate, post-check=0, pre-check=0' );
header('content-disposition: attachment; filename="' . $fileName . '"' );
header('content-size: ' . count($fileData) );
header('content-transfer-encoding: binary' );
header('content-type: application/octet-stream' );
echo $fileData;
?>
Re: auto delete file after download
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 [at] example.com> wrote in message
news:ENyJh.23$Ik4.5 [at] newsfe06.lga...
>
> "kick ass" <pub_lander [at] yahoo.com> wrote in message
> news:et613g$a67$1 [at] 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 = [at] 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;
> ?>
>
>
Re: auto delete file after download
"kick ass" <pub_lander [at] yahoo.com> wrote in message
news:et6ge1$p9j$1 [at] news1.carnet.hr...
| 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
you're welcome...and, it's not too complicated at all. i'd take a two
pronged approach. i've described the expiration method already. i'd also
allow the user to manually delete files that are no longer of their
interest. they may see them as clutter in their 'mailbox'. giving them the
ability to delete them is just good etiquette on your part.
i'd not actually delete the files if you plan on tracking/auditing...just
mark them as 'inactive' or something and don't display them again. that way,
depending on the nature/importance, of what is being communicated, your
report showing the communications will be more valuable...especially if the
authenticisty of the downloaded doc comes into question i.e. altered
(important for contracts, bol's, sla's, rfp's etc.)
anyway, i get the impression that you're comfortable with the db stuff so i
won't go into all that. i would however, still suggest that you run your
expiration script in an automated fashion (like on a cron job). you can
still build in the ability for you to manually expire stuff too.
anyway, hth.
Re: auto delete file after download
I'm almost finished.
I decided to give user the option to answer "yes" or "no" on question "Did
you download your file successfuly?"
If he has pressed "yes", I get notification in my db and then I can choose
if I want to delete file or not.
Later I will also do the expiration script.
Thanks for your help.
"Steve" <no.one [at] example.com> wrote in message
news:KCAJh.32$oI2.3 [at] newsfe05.lga...
>
> "kick ass" <pub_lander [at] yahoo.com> wrote in message
> news:et6ge1$p9j$1 [at] news1.carnet.hr...
> | 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
>
> you're welcome...and, it's not too complicated at all. i'd take a two
> pronged approach. i've described the expiration method already. i'd also
> allow the user to manually delete files that are no longer of their
> interest. they may see them as clutter in their 'mailbox'. giving them the
> ability to delete them is just good etiquette on your part.
>
> i'd not actually delete the files if you plan on tracking/auditing...just
> mark them as 'inactive' or something and don't display them again. that
> way,
> depending on the nature/importance, of what is being communicated, your
> report showing the communications will be more valuable...especially if
> the
> authenticisty of the downloaded doc comes into question i.e. altered
> (important for contracts, bol's, sla's, rfp's etc.)
>
> anyway, i get the impression that you're comfortable with the db stuff so
> i
> won't go into all that. i would however, still suggest that you run your
> expiration script in an automated fashion (like on a cron job). you can
> still build in the ability for you to manually expire stuff too.
>
> anyway, hth.
>
>
Re: auto delete file after download
no problem.
best wishes.
"kick ass" <pub_lander [at] yahoo.com> wrote in message
news:et8o4c$l8o$1 [at] news1.carnet.hr...
| I'm almost finished.
| I decided to give user the option to answer "yes" or "no" on question "Did
| you download your file successfuly?"
| If he has pressed "yes", I get notification in my db and then I can choose
| if I want to delete file or not.
| Later I will also do the expiration script.
| Thanks for your help.
|
| "Steve" <no.one [at] example.com> wrote in message
| news:KCAJh.32$oI2.3 [at] newsfe05.lga...
| >
| > "kick ass" <pub_lander [at] yahoo.com> wrote in message
| > news:et6ge1$p9j$1 [at] news1.carnet.hr...
| > | 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
| >
| > you're welcome...and, it's not too complicated at all. i'd take a two
| > pronged approach. i've described the expiration method already. i'd also
| > allow the user to manually delete files that are no longer of their
| > interest. they may see them as clutter in their 'mailbox'. giving them
the
| > ability to delete them is just good etiquette on your part.
| >
| > i'd not actually delete the files if you plan on
tracking/auditing...just
| > mark them as 'inactive' or something and don't display them again. that
| > way,
| > depending on the nature/importance, of what is being communicated, your
| > report showing the communications will be more valuable...especially if
| > the
| > authenticisty of the downloaded doc comes into question i.e. altered
| > (important for contracts, bol's, sla's, rfp's etc.)
| >
| > anyway, i get the impression that you're comfortable with the db stuff
so
| > i
| > won't go into all that. i would however, still suggest that you run your
| > expiration script in an automated fashion (like on a cron job). you can
| > still build in the ability for you to manually expire stuff too.
| >
| > anyway, hth.
| >
| >
|
|
PHP » alt.php » auto delete file after download