javascript - Error with attaching file in Mozilla 24.0 -
early code had worked fine in browsers. after updating new version of mozilla got out error. in google found 1 link - https://bugzilla.mozilla.org/show_bug.cgi?id=796850, , don't understand, how rid of problems.
typeerror: cannot convert string bytestring because character @ index 0 has value 1054 greater 255. xhr.setrequestheader("x-file-name", file.name);
in code:
.... xhr.open('post', get_page_url() + '?operation=upload_files'); xhr.setrequestheader("cache-control", "no-cache"); xhr.setrequestheader("x-requested-with", "xmlhttprequest"); xhr.setrequestheader("x-file-name", file.name); xhr.send(file); ...
in file.name
normal cyrillic file name extension.
i solved problem:
xhr.setrequestheader("x-file-name", file.name);
replaced to..
xhr.setrequestheader("x-file-name", unescape(encodeuricomponent(file.name)));
Comments
Post a Comment