fixed error when filename included non-ascii chars (eg. German umlauts) and added a header with information about author and Github url

This commit is contained in:
Ralf Becker 2014-03-21 17:11:18 +00:00
parent d9f8160fff
commit fcc1737036

View File

@ -1,3 +1,10 @@
/**
* jquery-html5-upload
*
* @author Mikhail Dektyarev <mihail.dektyarow@gmail.com>
* @link https://github.com/mihaild/jquery-html5-upload
*/
(function($) { (function($) {
jQuery.fn.html5_upload = function(options) { jQuery.fn.html5_upload = function(options) {
@ -36,8 +43,8 @@
headers: { headers: {
"Cache-Control":"no-cache", "Cache-Control":"no-cache",
"X-Requested-With":"XMLHttpRequest", "X-Requested-With":"XMLHttpRequest",
"X-File-Name": function(file){return file.fileName ? file.fileName : file.name}, "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}, "X-File-Size": function(file){return file.fileSize ? file.fileSize : file.size;},
"Content-Type": function(file){ "Content-Type": function(file){
if (!options.sendBoundary) return 'multipart/form-data'; if (!options.sendBoundary) return 'multipart/form-data';
return false; return false;