Consider an ASP.NET page using the jQuery library Uploadify.
Here is the sequence of events on the ASP.NET webforms page:
- User clicks on a file upload control. Plain old HTML
<input type="file" />
- User picks an image file from their system using a Browse dialog. All working fine.
- A jQuery event fires. It calls an ashx that properly uploads as expected.
- Now that the file is uploaded, how can I change an
<asp:image>
on the calling .aspx page? Would really like to do this without a postback!
Here's the code!
<asp:Image ID="imgChangeMe" runat="server" /><br />
<input type="file" name="uploadify" id="uploadify" />
<script type="text/javascript">
$(document).ready(function() {
$("#uploadify").uploadify({
'uploader' : 'scripts/uploadify/uploadify.swf',
'script' : 'uploadify.ashx',
'folder' : 'uploads',
'queueID' : 'fileQueue',
'auto' : true,
'multi' : true
});
});
</script>
Question:
How would you implement the changing of the <asp:image>
to reflect the image that the user just uploaded?
This question really shouldn't be related to the uploading library, but rather, how to react to the return/end of execution of an .ashx? Should this be done in another jQuery method