I’m using Jquery Uploadify plugin for Attachments functionality within my ASP.NET MVC 4.5 project.
The plugin works well in IE and Chrome; however users have reported that files are not being uploaded in Firefox, Safari and Opera. Uploadify returns an “Http 302” response, I have scoured the forums and blogs but no luck.
Many of the suggested solutions are for PHP users. Below is the jQuery code. The action method I’m calling does not have an “Authorized” attribute. If anyone has any ideas please let me know.
$('#file_upload').uploadify({
'overrideEvents': ['onSelectError', 'onDialogClose'],
'formData': {'id': tid },
'swf': '/Scripts/uploadify/uploadify.swf',
'uploader': "/workitem/upload",
'fileDataName': 'file',
'fileTypeDesc': 'File',
'fileTypeExts': '*.jpg; *.jpeg; *.tiff; *.gif; *.bmp; *.png; *.pdf; *.doc; *.docx; *.docm; *.xls; *.xlsx; *.xlsm; *.ppt; *.pptx; *.txt',
'auto': false,
'multi': true,
'buttonText': 'BROWSE',
'queueSizeLimit': 10,
'sizeLimit': 1073741824,
'uploadLimit': 10,
'removeCompleted': true,
'queueID': 'queueContainer',
'onSelectError': function (a, b, c) {
var errorMsg;
if (b == -100)
errorMsg = 'You have reached the maximum number of files selected.';
else if (b == -110)
errorMsg = 'The file selected exceeds the file size limit.'
else if (b == -120)
errorMsg = 'The file selected has zero bytes and cannot be uploaded.'
else if (b == -130)
errorMsg = 'An invalid file type has been selected.'
},
'onUploadError': function (file, errorCode, errorMsg, errorString) {
alert(errorMsg);
}
});
EDIT: On further analysis using Fiddler while browsing with Firefox a 302 request was captured with the location path of “/Account/Login?ReturnUrl=%2fworkitem%2fupload”. That indicates that the user is not authenticated or lost session; however when using Chrome request of HTTP 200 is captured. Does anyone know why this is occurring?