I have to implement an image upload functionality in asp.net. The method I have followed works like this :-
Submit a form containing an <input type='file'>
element and set the target of the form to a named iframe[to give the impression of a Ajax request/response ]. The aspx file which this form is posted to, writes the image into the response as Reponse.Write("<img src='location'/>");
The image displayed is due for cropping (where i plan to use JCrop).
What I would like to know is : Is there another开发者_如何学Python way to display the image in a <div>
may be, rather than in an iframe which I think is far better than this approach.
If you have or can get access to the 'location' value you certainly have everything you need to be able to add a div element to your response:
Response.Write("<div><img src='location'/></div>");
Or possibly use something like jQuery to simply set the content of an existing div:
$("#uploadedImage").html("<img src='location' />");
In your HTML document:
<div id="uploadedImage"></div>
精彩评论