Picture Upload

I have a picture uploader on a web form that puts the picture into a folder in the root directory. When the user updates their picture, they need to hit the refresh button in the toolbar to see the updated picture. I put a response.redirct in there, and also tried an autopostbackurl. Neither of them worked. I think it might be because the picture is getting named the exact same name in the folder, but the picture is still being changed, just not showing up. Any ideas?

Comments

  • seancampbellseancampbell Pennsylvania, USA

    I don't know if I understand your problem exactly, but It sounds like your browser might be cashing the image. So it updates, but it displays the same because the name of the image is the same and the browser doesn't redownload it for display. Trying clearing your cache before refreshing the page (after upload). (IE: Tools->Internet Options->Delete Browsing History)
  • You understand the problem exactly. It won't work with IE Tools, and I tried a Meta Tag to not allow caching. Didn't work. Got anymore suggestions?
    :


    : I don't know if I understand your problem exactly, but It sounds
    : like your browser might be cashing the image. So it updates, but it
    : displays the same because the name of the image is the same and the
    : browser doesn't redownload it for display. Trying clearing your
    : cache before refreshing the page (after upload). (IE:
    : Tools->Internet Options->Delete Browsing History)


  • seancampbellseancampbell Pennsylvania, USA
    So lets restate the problem so I understand fully,

    The form is for uploading a picture. When the user uploads a picture that has the same filename as a picture already on the server, that picture does not update until the user clicks "Refresh" on the toolbar?

    I bet what is happenning is as follows:

    When you are on an ASP.Net form and you click a button, the page immediately posts back to call the code under the button. Going down the order of operations, it does a Page Load first and downloads objects to draw on the page, it then does the code requested (in this case the button click), then it paints the page. (I beleive this is the correct order of ops).

    Anyways, what may be happenning is the page loads the old image then uploads the new image. So the user thought that when the page reloaded the picture had already been uploaded, when in reality it didn't upload till "AFTER" the page reloads.

    If this is the case, try doing a Page.Validate() after the upload is complete.

    Hope this helps, let me know if I am understanding the problem incorrectly.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories