I decided not to trust FireBug 100%, so I put alerts in the javascript code to see where it was going.
startupload IS being called returns immediately, then the upload completes, and CuteWebUI_AjaxUploader_OnPostback() is then called. It completes - that is, submitbutton.click is called and returns immediately.
I also changed my scripts:
function submitbutton_click() {
var submitbutton = document.getElementById('<%=SubmitButton.ClientID %>');
var uploadobj = document.getElementById('<%=Uploader1.ClientID %>');
if (!window.filesuploaded) {
if (uploadobj.getqueuecount() > 0) {
uploadobj.startupload();
}
else {
var uploadedcount = parseInt(submitbutton.getAttribute("itemcount")) || 0;
if (uploadedcount > 0) {
return true;
}
alert("Please select the GPCM database to upload.");
}
return false;
}
window.filesuploaded = false;
return true;
}
function CuteWebUI_AjaxUploader_OnStop() {
var hidden = this;
hidden.internalobject.insertBtn.style.display = ''
}
function CuteWebUI_AjaxUploader_OnPostback() {
var hidden = this;
hidden.internalobject.insertBtn.style.display = ''
window.filesuploaded = true;
}
The important part is that I got rid of the explicit call to the buttonclick event inOnPostback, which somebody else wrote and never made sense. Web logs show a GET and POST operation done after the file is uploaded -- here's the web log, showing the monitor of the short upload, followed by the these:
2010-06-04 20:57:32 POST /admin/ScenarioImport/Upload.aspx UseUploadModule=Dynamic&_Namespace=CuteWebUI&_UploadID=ctl00_BodyPlaceholder_Uploader1Image_1275685058013_1&_UploadControlID=ctl00$BodyPlaceholder$Uploader1&ContextValue=!3wEWAQUbfi9hZG1pbi9TY2VuYXJpb0ltcG9ydC9UZW1wZJa8YwEmcrNLxl8h7tuhy8t5uH0!2&_Addon=upload&_AddonGuid=4b3f2536-5f62-4a37-8b62-dcb094af3c5d&_NoCache=634112566607380438 76.79.206.115 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.3)+Gecko/20100401+Firefox/3.6.3 - 200 220 90896
2010-06-04 20:57:32 POST /admin/ScenarioImport/Upload.aspx UseUploadModule=Dynamic&_Namespace=CuteWebUI&_UploadID=ctl00_BodyPlaceholder_Uploader1Image_1275685058013_1&_UploadControlID=ctl00$BodyPlaceholder$Uploader1&ContextValue=!3wEWAQUbfi9hZG1pbi9TY2VuYXJpb0ltcG9ydC9UZW1wZJa8YwEmcrNLxl8h7tuhy8t5uH0!2&_Addon=upload&_AddonGuid=4b3f2536-5f62-4a37-8b62-dcb094af3c5d&_NoCache=634112566616470958 76.79.206.115 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.3)+Gecko/20100401+Firefox/3.6.3 - 200 220 35458
2010-06-04 20:57:33 POST /admin/ScenarioImport/Upload.aspx UseUploadModule=Dynamic&_Namespace=CuteWebUI&_UploadID=ctl00_BodyPlaceholder_Uploader1Image_1275685058013_1&_UploadControlID=ctl00$BodyPlaceholder$Uploader1&ContextValue=!3wEWAQUbfi9hZG1pbi9TY2VuYXJpb0ltcG9ydC9UZW1wZJa8YwEmcrNLxl8h7tuhy8t5uH0!2&_Addon=verify&_AddonGuid=4b3f2536-5f62-4a37-8b62-dcb094af3c5d 76.79.206.115 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.3)+Gecko/20100401+Firefox/3.6.3 http://viewpoints.rbac.com/admin/ScenarioImport/Upload.aspx 200 425 19555
2010-06-04 20:57:33 GET /CuteWebUI_Uploader_Resource.axd type=file&file=uploadok.png&_ver=634112602042073726 76.79.206.115 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.3)+Gecko/20100401+Firefox/3.6.3 http://viewpoints.rbac.com/admin/ScenarioImport/Upload.aspx 200 610 690
2010-06-04 20:57:33 POST /admin/ScenarioImport/Upload.aspx - 76.79.206.115 HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.1;+en-US;+rv:1.9.2.3)+Gecko/20100401+Firefox/3.6.3 http://viewpoints.rbac.com/admin/ScenarioImport/Upload.aspx 200 288 24330
Both the GET and POST are in fact received at the code-behind - I put some logging into its Page_Load to indicate when it gets a callback or postback, and it's getting two postbacks.