]> source.dussan.org Git - redmine.git/commitdiff
fix Drag & Drop does not work with Safari 5.1 (#17581, #13932)
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 26 Aug 2014 01:17:01 +0000 (01:17 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Tue, 26 Aug 2014 01:17:01 +0000 (01:17 +0000)
Contributed by fred bregar.

git-svn-id: http://svn.redmine.org/redmine/trunk@13346 e93f8b46-1217-0410-a6f0-8f06a7374b81

public/javascripts/attachments.js

index 43803ba9c9e62428779c812b4b2818b6f84853ef..a67ca4a722b60cf6fb354983958699e54133b3ae 100644 (file)
@@ -99,8 +99,10 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
   return $.ajax(uploadUrl, {
     type: 'POST',
     contentType: 'application/octet-stream',
-    beforeSend: function(jqXhr) {
+    beforeSend: function(jqXhr, settings) {
       jqXhr.setRequestHeader('Accept', 'application/js');
+      // attach proper File object 
+      settings.data = blob;
     },
     xhr: function() {
       var xhr = $.ajaxSettings.xhr();
@@ -117,7 +119,7 @@ function uploadBlob(blob, uploadUrl, attachmentId, options) {
 function addInputFiles(inputEl) {
   var clearedFileInput = $(inputEl).clone().val('');
 
-  if ('FileReader' in window && inputEl.files) {
+  if (inputEl.files) {
     // upload files using ajax
     uploadAndAttachFiles(inputEl.files, inputEl);
     $(inputEl).remove();