File to Download gets requestet twice
| From: | Stefan Rusterholz | Date: | Fri, 02 Nov 2001 10:39:24 +0000 |
| Subject: | File to Download gets requestet twice | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-73246@lists.php.net to get a copy of this message | ||
I have a small but serious problem:
In a webproject of mine a user can select a link to get a compressed archive of files.
The system works in this order:
1 -User clicks the link "download all"
2 ->PHP generates the ZIP-compressed file and presents the user the next website with a link
"File Archive"
3 -User clicks the link "File Archive"
4 ->PHP reads the file, deletes it and puts it to the browser
Now, where is the problem:
some browsers request the link in step 3 a first time and present the user then a dialog "Save
file to" (or something similar) and after that dialog those browsers request the link a second
time. But because PHP doesn't "know" that the browser hasn't really downloaded
the file but only presented the user some dialog, it has the file already deleted. So the second
time the browser downloads only my error message "Download-Link expired".
How can I do a workaround?
I tried to send a header that it is a .zip file. Didn't work.
I tried to send data without header at all. Didn't work.
I tried several other stupid things which all didn't work.
For some reasons I _have_ to delete the file after beeing downloaded. So I have to either find out
if the browser only requested the header but not the file (so I can let it there and don't
delete it) or I have to find a way that the browser request that thing only once (which is obviously
possible because some IE Versions under Windows encountered no problems with that)
Has someone an Idea or a working work-around?
Any help would be appreciated...
Best regards
Stefan Rusterholz, s.rusterholz@interaktion.ch
----------------------------------
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
----------------------------------
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
----------------------------------