I have an Send.aspx page that has an uploadify control on it. Upload.ashx handles the file upload.
I am adding a file record to a sql database in the Upload.ashx file and I need to get the ID of that record back from Upload.aspx when it is done.
Can't get it working with Sessions. =( Something to do with an Adobe bug?
What would the best way to handle this be?
Here is the uploadify control:
<script type="text/javascript">
// <![CDATA[
var contestID = $('[id$=HiddenFieldContestID]').val();
var maxEntries = $('[id$=HiddenFieldMaxEntries]').val();
var userID = $('[id$=HiddenFieldUserID]').val();
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader': '../uploadify/uploadify.swf',
'script': '../uploadify/Upload.ashx',
'scriptData': { 'contestID': contestID, 'maxEntries': maxEntries, 'userID': userID },
'cancelImg': '../uploadify/cancel.png',
'auto': true,
'multi': false,
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.png;*.jpeg',
'queueSizeLimit': 1,
'sizeLimit': 4000000,
'buttonText': 'Choose Image',
'folder': '/uploads',
'onAllComplete': function(event, queueID, fileObj, response, data) {
document.getElementById('<%= ButtonCleanup.ClientID %>').click();
}
});
});
// ]]></script>
This took a while for me to figure out. But in retrospect it is extremely simple. For this reason, I mad a video tutorial to help newcomers get started quickly and understand how this awesome control works.
Video Tutorial from start to finish:
http://casonclagg.com/articles/6/video-tutorial-uploadify-asp-net-c-sharp.aspx