header("Content-type: image/png"); makes script run twice?
Pirata Nervo Offline
Member
***
Posts: 235
Joined: Jan 2008
Post: #3
RE: header("Content-type: image/png"); makes script run twice?
The script outputs the file once (not in multiple parts so it's limited to PHP's max post size). I'm not sure what you mean by early termination, once the file is sent to the user, the script has done its job.

After messing a bit with Fiddler I came to a different conclusion.

   

Notice that the last one has a different content-type so I decided to compare both of them in more depth.

The first request is the one which has the fields: postcode, did, action and process. The second contains no fields at all thus we get the image for the first one and the MyDownloads index page for the second.

After doing some tests with MyBB attachments and different file types in both MyBB attachments and MyDownloads, I conclude that only images are affected - even text files which are displayed inline are not affected.

After switching the Content-type to application/force-download this issue no longer happens so the problem is a browser problem related to image content-types.

So I believe the link I have posted ( http://forums.mysql.com/read.php?52,1143...http://forums.mysql.com/read.php?52,114324,114324# ) is correct but I don't see a solution there.

Perhaps switching all of them to force-download will fix this issue. No one has ever reported this in MyBB because the download counter is not shown for images thus it wasn't noticeable, but it's there.

I'm not sure if you can help me much more though.
06-22-2011 08:53 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
RE: header("Content-type: image/png"); makes script run twice? - Pirata Nervo - 06-22-2011 08:53 PM

 Standard Tools
Forum Jump: