Uploadify is a jQuery/Flash plugin for uploading multiple files. It's working great, except I can't figure out how trigger e-mail when all files are complete. If I try to add something like <% SendEmail(); %>
to the onAllComplete parameter, it just sends the e-mail when the page loads.
Is there a way to do this within the handler recommended here or from this post? Or is there some way to trigger a post in the onAllComplete parameter?
<script type="text/javascript">
// <![CDATA[
var FirstName = $('[id$=HiddenField4]').val();
var MiddleName = $('[id$=HiddenField5]').val();
var ClientName = $('[id$=HiddenField6]').val();
var queueSize = $('#fileInput').uploadifySettings('queueSize');
$(document).ready(function() {
$('#fileInput').uploadify({
'uploader': 'scripts/uploadify/uploadify.swf',
'script': 'Upload.ashx',
'scriptData': { 'first': FirstName, 'middle': MiddleName, 'client': ClientName, 'queueSize': queueSize },
'cancelImg': 'scripts/uploadify/cancel.png',
'auto': true,
'multi': true,
'fileDesc': 'Image Files',
'fileExt': '*.jpg;*.png;*.gif;*.bmp;*.jpeg;*.pdf',
'queueSizeLimit': 90,
'sizeLimit': 10000000,
'buttonText': 'Upload Documents',
'folder': '/uploads',
'onComplete': function(event, queueID, fileObj, response, data) {
alert(response);
},
'onAllComplete': function(event, queueID, fileObj, response, data) {
<% SendEmail(); %>
},
'buttonImg': 'images/upload.png'
});
});
// ]]></script>
I've also tried queueSize declaring it as
var queueSize = $(".uploadifyQueueItem").size();
queueSize always posts as 0 when I debug my handler.