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.

Tried:
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.

Thanks!

Recommended Answers

All 2 Replies

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.