Using SWFUpload, why are my uploads not being proceesed by upload.aspx when using Firefox (they are processed correctly in IE)?
Using SWFUpload v2.2, Firefox 3, IE 8, Flash 10
In my ASP.NET application all uploads are being processed by upload.aspx (I have the correct upload_url set in the settings object).Can anyone tell me why (in Firefox) the uploads never hit the upload.aspx page?
Most of the code for the page that the user visits to upload a file is shown here (note: master pages are being used):
<script type="text/javascript" src="../swfupload/swfupload.js"></script>
<script type="text/javascript" src="../js/handlers.js"></script>
<script type="text/javascript"&开发者_C百科gt;
var swfu;
window.onload = function() {
swfu = new SWFUpload({
// Backend Settings
upload_url: "../upload.aspx",
post_params: {
"ASPSESSID": "<%=Session.SessionID %>"
},
// File Upload Settings
file_size_limit: "10 MB",
file_types: "*.*",
file_types_description: "All Files",
file_upload_limit: 1,
file_queue_limit: 1,
//assume_success_timeout: 60,
// Event Handler Settings - these functions as defined in Handlers.js
// The handlers are not part of SWFUpload but are part of my website and control how
// my website reacts to the SWFUpload events.
file_queue_error_handler: fileQueueError,
file_dialog_complete_handler: fileDialogComplete,
upload_progress_handler: uploadProgress,
upload_error_handler: uploadError,
upload_success_handler: uploadSuccess,
upload_complete_handler: uploadComplete,
// Button settings
button_image_url: "../Images/XPButtonNoText_160x22.png",
button_placeholder_id: "spanButtonPlaceholder",
button_width: 160,
button_height: 22,
button_text: '<span class="button">Upload File<span class="buttonSmall">(10 MB Max)</span></span>',
button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
button_text_top_padding: 1,
button_text_left_padding: 5,
// Flash Settings
flash_url: "../swfupload/swfupload.swf", // Relative to this file
custom_settings: {
upload_target: "divFileProgressContainer"
},
// Debug Settings
debug: false
});
}
</script>
Good chance that since this is working in IE and not in Firefox and you are trying to do some authentication ( hence post_params: { "ASPSESSID": "<%=Session.SessionID %>" },) you are hitting the flash/firefox/opera "bug"/issue. In this case the flash uploader is actually running in its own context and not in the shared context and can not acess the cookies for the sessionID.
Use a debugger to check and see what is being generated or if you have an error there.
There are several threads in the forum here, I think some for ASP ( not my specialty) that give some workarounds. Search for flash, upload, sessionId and ( ASP)
The code looks o.k. to me.
Does the Firefox console show any errors?
Can you try using paths relative to the web root
/xyz/swfupload/upload.aspx
to make sure it's not a case of relative paths being resolved differently?Are you 1000% sure your aspx file is actually not being called? Or could it be that just the authentication process goes wrong for some reason? Can you put a log or mail command into the 1st line of the ASPX file?
Does the upload process itself start and show a progress bar?
SWFUpload comes with error handler hooks. Do none of them throw an error message?
精彩评论