Firefox에서 일부 파일명을 인식하지 못하는 버그 수정(Workaround)

- 일부 파일은 Base64로 인코딩하면 / 를 포함하는데, PHP에서는 파일명에 /를 아예 허용하지 않아 LV/xxxx와 같은 문자열이 잘려서 xxxx로만 전달받게 된다. 따라서, Base64로 디코딩해도 원래의 파일명을 얻을 수 없었다. 전송전에 /를 :로 치환하고 다시 전달받은 후에는 반대 과정을 실행하여 문제를 해결했다.


git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7958 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2010-12-07 02:35:26 +00:00
parent 2709f387e4
commit 7e6cfcb36d
2 changed files with 6 additions and 4 deletions

View file

@ -367,7 +367,7 @@ runtimes.html5 = {
// Firefox had a bug that recognises some unicode filename as invalid string.
// So, I made a workaround to encode the filename by RFC2231
data += '--'+bndr+'\r\n';
data += 'Content-Disposition: form-data; name="Filedata"; filename="=?UTF-8?B?'+Base64.encode(file.name)+'?="\r\n';
data += 'Content-Disposition: form-data; name="Filedata"; filename="=?UTF-8?B?'+Base64.encode(file.name).replace(/\//g, ':')+'?="\r\n';
data += 'Content-Type: application/octet-stream\r\n\r\n';
data += file.object.getAsBinary();
data += '\r\n';