• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1118
  • Last Modified:

ASP.net 2.0 fileupload and image overwritting

Hi Experts,

Controls used: Asp file upload control ,asp.net 2.0,IE/Mozilla

Newly uploaded Image doesnt appear on the browser window even after refreshing the page, if I upload a different image with the same filename as the previously uploaded one.

1)     I have uploaded bipin.jpg to the server and preview displays bipin.jpg

2)     I have changed an existing image rohan.jpg to the server and preview displays rohan.jpg

3)     I have changed the name of rohan.jpg to bipin.jpg and try uploading and now the image displayed in the browser is still that of bipin.jpgs last content.(ideally it should display the photo of rohan as I just changed the image file name of rohans image to bipin)

I have tried with clearing cache in browser as well as in code but didn't work. please can you suggest me the solution for this weired behavior?

1 Solution
Seems like a cahing problem!! That is when ever you dont hav any change in URL it will show cached image !! To avoid this you can just pass a random number as Querystring!! Better pass GUID as Query string while refering URL

SwapnilSoftware ArchitectAuthor Commented:

I have ?t=+ Guid.NewGuid().ToString() appended in URL.

Thanks Renju, It works.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now