I have an application that I wrote that allows users to upload files (pictures or PDFs). I am using IIS 6 and php 5.4. The problem I am having is that it seems like file uploads are getting cached somehow. For example, if I upload the same file over and over it works just fine, but as soon as I upload a different file, that particular file and anyone after it is corrupt when trying to view it after it is uploaded. Once I do a hard refresh (Ctrl+F5) in the browswer, the first file works fine again when uploading, but as soon as I upload a different file it becomes corrupt. I am using Google Chrome and IE9.

session_start(); at the beginning of page doing the uploading.
tacked on a timestamp to the end of the url doing the uploading.
Checked to php max_upload size (which is fine).
Immediately expire content headers in IIS.

It almost seems like an IIS problem, but I could be wrong. I hope I posted this in the right place, and any help is appreciated.


5 Years
Discussion Span
Last Post by dschuett

What do you mean by corrupt?? Are you uploading image file, how do you know file is corrupted?
Also check both file's size.


It will literally say that "this file is corrupt" when trying to open the file. And what's weird is that both the orignal file and the uploaded file are the same file size.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.