0

I'm using the control FileUpload to choose an image and upload but now I want to display a preview of the chosen image before saving the image, just to give the user an output of the chosen image.

I googled but could not find an answer for that.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
ithieme1
  • 45
  • 3
  • 9
  • I have edited your title. Please see, "[Should questions include “tags” in their titles?](http://meta.stackexchange.com/questions/19190/)", where the consensus is "no, they should not". – John Saunders Oct 24 '12 at 18:31
  • 1
    Why not create a PictureBox and set the property Image to the selected file path? You may then create a button "Confirm" that processes the upload on its click. Have a great day :) – Picrofo Software Oct 24 '12 at 18:31
  • http://forums.asp.net/t/1463798.aspx/1 – Ruchi Oct 24 '12 at 18:49
  • If you use MVC, you might try method: http://stackoverflow.com/questions/9092723/preview-image-before-uploading-file – Murat Yıldız Mar 13 '15 at 15:13

1 Answers1

1

The problem is you have to upload the image to your server to you can display(serve) it. I did some searching, and found this question: How to show local picture in web page? - and I was thinking, if you have the local path of the image, why not use some ajax to pop the url in a simple img tag.

However, you can't even link to a local image anymore, due to security. So for your application to show a preview of the image you would have to first have the image to display it, and the upload would have to occur first.

Community
  • 1
  • 1
bugnuker
  • 3,918
  • 7
  • 24
  • 31