Defect #14953
openIntermittent AJAX Atttachement Upload Failure in Firefox
0%
Description
(Firslty, thanks to all involved in this great product)
I'm running Redmine v2.3.2 under Windows Apache with ModSSPI (for NTLM) and thin.
The AJAX Document upload works perfect in IE and Chrome but intermittently fails in Firefox.
The first upload can succeed, then adding more documents results in 'error' appearing in the Optional Description element and the document fails to upload.
Looking at the Apache access logs it appears that the problem is related to authentication; with the working attempts logging user IDs and the failed attempts without. With Chrome you can see 2 attempts and the third attempt authenticating, in IE, you see nothing.
I've tried setting SSPIPerRequestAuth but that's made no difference. Help greatly appreciated.
Related issues
Updated by Charlie Beckett about 11 years ago
Is there any easy way to more to fallback to the none ajax method whilst I investigate ?
Updated by Thomas Löber about 11 years ago
Hi Charlie,
I have also experienced upload failures when there was too much time between two uploads.
The problem seems to be that the AJAX POST request (in contrast to GET) doesn't try to re-authenticate when the connection to the server was closed after some time of inactivity.
However I was able to build a workaround by issuing an AJAX GET request in case of failure and then try the upload (POST) again:
--- public/javascripts/attachments.js.orig +++ public/javascripts/attachments.js @@ -53,6 +53,12 @@ fileSpan.find('input.description, a').css('display', 'inline-block'); }) .fail(function(result) { + if (result.status == 0 && result.statusText == "error") { + var url = $(inputEl).data("upload-path").replace(/^\/([^/]+).*/, "/$1/authenticate.txt"); + $.ajax({url: url, cache: false}). + done(function() { actualUpload(file, attachmentId, fileSpan, inputEl); }); + return; + } progressSpan.text(result.statusText); }).always(function() { ajaxUpload.uploading--;
You will have to create an empty file authenticate.txt
in public
for this to work.
Best regards,
Thomas
Updated by Thomas Löber about 11 years ago
I have just seen that the regexp above handles the Rails URL prefix. If you do not use this feature you may use "/authenticate.txt" directly:
var url = "/authenticate.txt";
Updated by Charlie Beckett about 11 years ago
Hi Thomas
Thanks for helping with this. This seems to work really well in IE, but now the file doesn't upload in Firefox and Chrome reports "Not Acceptable" after several tries.
Updated by D G about 11 years ago
Same problem here. Redmine 2.4.1 + Kerberos. Until this error is fixed we use included fallback form submission:
--- public/javascripts/attachments.js (revision 12347)
+++ public/javascripts/attachments.js (working copy)
@@ -117,19 +117,12 @@
function addInputFiles(inputEl) {
var clearedFileInput = $(inputEl).clone().val('');
- if (inputEl.files) {
- // upload files using ajax
- uploadAndAttachFiles(inputEl.files, inputEl);
- $(inputEl).remove();
- } else {
- // browser not supporting the file API, upload on form submission
var attachmentId;
var aFilename = inputEl.value.split(/\/|\\/);
attachmentId = addFile(inputEl, { name: aFilename[ aFilename.length - 1 ] }, false);
if (attachmentId) {
$(inputEl).attr({ name: 'attachments[' + attachmentId + '][file]', style: 'display:none;' }).appendTo('#attachments_' + attachmentId);
}
- }
clearedFileInput.insertAfter('#attachments_fields');
}
Updated by Toshi MARUYAMA over 10 years ago
- Related to Defect #6089: Large uploads fails with Firefox added