Download a file once

I want a user to download to download bec.exe from download.php. But,
the next time anyone accesses download.php, i want it to turn up a
Error 404 page or simply a sentence saying "sorry, this file is not
available". Could someone help me? Thanks
majik92 [ Di, 16 Januar 2007 02:56 ] [ ID #1597280 ]

Re: Download a file once

majik92 [at] gmail.com wrote:
> I want a user to download to download bec.exe from download.php. But,
> the next time anyone accesses download.php, i want it to turn up a
> Error 404 page or simply a sentence saying "sorry, this file is not
> available". Could someone help me? Thanks
>

Have the Download.php file delete, move or rename the file.
Then the message will have the added virtue of being true.
Bucky Kaufman [ Di, 16 Januar 2007 03:17 ] [ ID #1597281 ]

Re: Download a file once

Sanders Kaufman schreef:
> majik92 [at] gmail.com wrote:
>> I want a user to download to download bec.exe from download.php. But,
>> the next time anyone accesses download.php, i want it to turn up a
>> Error 404 page or simply a sentence saying "sorry, this file is not
>> available". Could someone help me? Thanks
>>
>
> Have the Download.php file delete, move or rename the file.
> Then the message will have the added virtue of being true.

Not a good idea on a busy website

Create a unique download id and match it against your stored(allowed) id's
link to the file download.php?id=<my_dl_id>

use fpassthru('/files/file.exe');
to send the file


--
Arjen
http://www.hondenpage.com
Dave Williams [ Di, 16 Januar 2007 13:06 ] [ ID #1597300 ]

Re: Download a file once

majik92 [at] gmail.com wrote:
> I want a user to download to download bec.exe from download.php. But,
> the next time anyone accesses download.php, i want it to turn up a
> Error 404 page or simply a sentence saying "sorry, this file is not
> available". Could someone help me? Thanks
>

Have the Download.php file delete, move or rename the file.
Then the message will have the added virtue of being true.
Bucky Kaufman [ Di, 16 Januar 2007 03:17 ] [ ID #1597386 ]

Re: Download a file once

Sanders Kaufman schreef:
> majik92 [at] gmail.com wrote:
>> I want a user to download to download bec.exe from download.php. But,
>> the next time anyone accesses download.php, i want it to turn up a
>> Error 404 page or simply a sentence saying "sorry, this file is not
>> available". Could someone help me? Thanks
>>
>
> Have the Download.php file delete, move or rename the file.
> Then the message will have the added virtue of being true.

Not a good idea on a busy website

Create a unique download id and match it against your stored(allowed) id's
link to the file download.php?id=<my_dl_id>

use fpassthru('/files/file.exe');
to send the file


--
Arjen
http://www.hondenpage.com
Dave Williams [ Di, 16 Januar 2007 13:06 ] [ ID #1597420 ]

Re: Download a file once

Arjen wrote:
> Sanders Kaufman schreef:

>> Have the Download.php file delete, move or rename the file.
>> Then the message will have the added virtue of being true.
>
> Not a good idea on a busy website

Why? That seems nice and QUICK.


> Create a unique download id and match it against your stored(allowed) id's
> link to the file download.php?id=<my_dl_id>


Gosh, that seems like an awful lot more processing power than
just a simple delete.


> use fpassthru('/files/file.exe');
> to send the file

IS fpassthru an undocumented feature or something?
I can't find anything about it.
Bucky Kaufman [ Mi, 17 Januar 2007 03:29 ] [ ID #1598840 ]

Re: Download a file once

Sanders Kaufman schreef:
> Arjen wrote:
>> Sanders Kaufman schreef:
>
>>> Have the Download.php file delete, move or rename the file.
>>> Then the message will have the added virtue of being true.
>>
>> Not a good idea on a busy website
>
> Why? That seems nice and QUICK.

yup it does for a single file and a single user.
But if you need a lot of unique download files you dont want to recreate
and delete the same file over and over again.

>> Create a unique download id and match it against your stored(allowed)
>> id's

>> link to the file download.php?id=<my_dl_id>
>
>
> Gosh, that seems like an awful lot more processing power than just a
> simple delete.
You are repeating ur first point wich is valid for some, but not ll
situations

>
>> use fpassthru('/files/file.exe');
>> to send the file
>
> IS fpassthru an undocumented feature or something?
> I can't find anything about it.

Come to think about it .. readfile() would be better but fpassthru would
work

RTFM :-)

http://www.php.net/manual/en/function.fpassthru.php

--
Arjen
http://www.hondenpage.com
Floortje [ Mi, 17 Januar 2007 09:40 ] [ ID #1598877 ]

Re: Download a file once

Arjen wrote:
> Sanders Kaufman schreef:

>> Have the Download.php file delete, move or rename the file.
>> Then the message will have the added virtue of being true.
>
> Not a good idea on a busy website

Why? That seems nice and QUICK.


> Create a unique download id and match it against your stored(allowed) id's
> link to the file download.php?id=<my_dl_id>


Gosh, that seems like an awful lot more processing power than
just a simple delete.


> use fpassthru('/files/file.exe');
> to send the file

IS fpassthru an undocumented feature or something?
I can't find anything about it.
Bucky Kaufman [ Mi, 17 Januar 2007 03:29 ] [ ID #1598938 ]

Re: Download a file once

Sanders Kaufman schreef:
> Arjen wrote:
>> Sanders Kaufman schreef:
>
>>> Have the Download.php file delete, move or rename the file.
>>> Then the message will have the added virtue of being true.
>>
>> Not a good idea on a busy website
>
> Why? That seems nice and QUICK.

yup it does for a single file and a single user.
But if you need a lot of unique download files you dont want to recreate
and delete the same file over and over again.

>> Create a unique download id and match it against your stored(allowed)
>> id's

>> link to the file download.php?id=<my_dl_id>
>
>
> Gosh, that seems like an awful lot more processing power than just a
> simple delete.
You are repeating ur first point wich is valid for some, but not ll
situations

>
>> use fpassthru('/files/file.exe');
>> to send the file
>
> IS fpassthru an undocumented feature or something?
> I can't find anything about it.

Come to think about it .. readfile() would be better but fpassthru would
work

RTFM :-)

http://www.php.net/manual/en/function.fpassthru.php

--
Arjen
http://www.hondenpage.com
Floortje [ Mi, 17 Januar 2007 09:40 ] [ ID #1598953 ]
PHP » alt.php » Download a file once

Vorheriges Thema: PHP Image Weirdness (using POST variables from Flash)
Nächstes Thema: how to convert text into mysql date format?