LPology / Simple-Ajax-Uploader

Javascript file upload plugin with progress bar support. Works in all major browsers, including IE7+, Chrome, Firefox, Safari, and Opera. No dependencies - use it with or without jQuery.
995 stars 267 forks source link

filename with non-english letter will be stuck. #110

Closed cipherchien closed 9 years ago

cipherchien commented 9 years ago

everything is smooth with normal english filename, ex: test01.png, abc.png... but, if upload filename with non-english letter, ex: 中文字.png , it will show the error message:

TypeError: Cannot convert string to ByteString because the character at index 0 has value 27138 which is greater than 255.
xhr.setRequestHeader( i, headers[ i ] + '' );   

here is my js code:

            var uploader = new ss.SimpleUpload({
                button: btn,
                url: '/upload/images',
                name: 'uploadfile',
                responseType: 'json',
                multipart: true,
                startXHR: function () {
                    ...
                },
                onComplete: function (filename, response) {
                ...
                },
                onError: function () {
                }
            });

Thanks for reading, any guidance or input is appreciated.

gleblobanov commented 9 years ago

Try (headers[ i ] + '') % 255

cipherchien commented 9 years ago

Thanks your reply.

is-blackhole commented 9 years ago

Have same issue with X-File-Name header with russian chars in filename... Do you plan to include fix in HEAD?