Forum Moderators: coopster

Message Too Old, No Replies

Checking file has downloaded - IE problem

         

optik

4:43 pm on Jul 6, 2010 (gmt 0)

10+ Year Member



Hi

I have a download script I've written that allows a file to be downloaded a certain number of times before the link expires, the script also removes the download link from the users account when the file has been fully downloaded.

Now this all works fine, except IE's security settings are messing things up and I can't ask each user to start fiddling with these settings even though that fixes the problem.

In IE7+ 8 when the user clicks the download link IE pops up its info bar and the user has to select to download the file.

What's happening though is that somehow IE has managed to already download the file from the server without actually saving it anywhere accessible to the user, this prompts the PHP script to expire the link so when IE goes for it's supposed first attempt and error is thrown up because the link has expired.

Does anyone have any suggestions about what could be done here, I need to to preserve the functionality of the script and I will definitely not resort to instructing user to adjust their security settings.

IE strikes again!

optik

4:50 pm on Jul 6, 2010 (gmt 0)

10+ Year Member



Update:

Looking at the script IE isn't downloading the file the first time, it's blocking the headers for the download but completing the PHP script.

What I need is a way to know that the readfile() function has completed it's task rather than simply adding my expire code at the end of the download script assuming the headers haven't been blocked.

optik

5:08 pm on Jul 6, 2010 (gmt 0)

10+ Year Member



Well I've used the value readfile returns to check the file has been downloaded and then expire the link only if it has and IE is definitely downloading the file even though it says it has blocked it.

optik

12:08 pm on Jul 8, 2010 (gmt 0)

10+ Year Member



Still no further on this anyone got any ideas?

rocknbil

6:32 pm on Jul 8, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not sure what you mean by blocked it? What's the file type? What headers are you sending? Sounds like you have it sorted, what problems are you still having?

optik

9:39 pm on Jul 8, 2010 (gmt 0)

10+ Year Member



The download starts automatically using an iFrame rather than the user clicking a direct link so IE is blocking this and popping up the info bar above the page where the user is asked to accept the download.

Headers used are

header("Content-type: application/octet-stream");
header("Content-Description: File Transfer");
header("Content-Transfer-Encoding: binary");
header("Content-length: $filesize");
header("Content-Disposition: attachment; filename=$filename);

I thought I had it sorted because I can check the bytes fread has returned but that doesn't seem to be anything to do with data IE has downloaded.