From fcc1737036be5533763fe08cce95d5448244b9b1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 21 Mar 2014 17:11:18 +0000 Subject: [PATCH] fixed error when filename included non-ascii chars (eg. German umlauts) and added a header with information about author and Github url --- phpgwapi/js/jquery/jquery.html5_upload.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/phpgwapi/js/jquery/jquery.html5_upload.js b/phpgwapi/js/jquery/jquery.html5_upload.js index 3b7c118b42..54f6166e0a 100644 --- a/phpgwapi/js/jquery/jquery.html5_upload.js +++ b/phpgwapi/js/jquery/jquery.html5_upload.js @@ -1,3 +1,10 @@ +/** + * jquery-html5-upload + * + * @author Mikhail Dektyarev + * @link https://github.com/mihaild/jquery-html5-upload + */ + (function($) { jQuery.fn.html5_upload = function(options) { @@ -36,8 +43,8 @@ headers: { "Cache-Control":"no-cache", "X-Requested-With":"XMLHttpRequest", - "X-File-Name": function(file){return file.fileName ? file.fileName : file.name}, - "X-File-Size": function(file){return file.fileSize ? file.fileSize : file.size}, + "X-File-Name": function(file){return encodeURIComponent(file.fileName ? file.fileName : file.name);}, + "X-File-Size": function(file){return file.fileSize ? file.fileSize : file.size;}, "Content-Type": function(file){ if (!options.sendBoundary) return 'multipart/form-data'; return false; @@ -175,7 +182,7 @@ builder += crlf; // Give eGW a chance to interfere - if(typeof(options.beforeSend) == "function") { + if(typeof(options.beforeSend) == "function") { builder += dashdash; builder += boundary; builder += crlf;