asp.net - Display an image in an Image control using FileUpload -


i want show image in image control user select image file through fileupload control, don't want image saved on server.

the best have uploaded memory, , without saving display using .ashx or something.

edit

before html5, perhaps have done having javascript function takes directory of uploaded file , sets img src property filepath. image load preview own hard drive. in html5 compliant browsers, filepath hidden can't use in javascript. happens in ie8, chrome, etc.

here's messy way it.

first, create javascript function handle fileupload controls onchange event. when event fires, post entire form.

        function uploadfile() {         var value = $("#<%=futest.clientid %>").val();         if (value != '') {             $("#form1").submit();         }     } 

here upload control:

    <asp:fileupload runat="server" id="futest" onchange="uploadfile()" /> 

now, when chooses file, form posts , can take image memory on server , display when postback complete.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -