Search code examples
javascriptjqueryfile-uploaduploadifyswfupload

Flash uploaders (Uploadify and SwfUpload) - problems with special characters in filenames


I need to implement a flash-based file-uploader, that will allow me to upload multiple files at once and view progress.

I tried Uploadify and SwfUpload and it was quite easy getting them to work.

However, for both I run into problems, when the users try to upload files, that have filenames with special characters (such as Danish æøå or sweedish ö - and others I am sure).

The file uploads fine, but the filename is screwed up:

  • malmö.jpg becomes malmö.jpg
  • æblemoster.jpg becomes æblemoster.jpg

I have of course tried feeding the files to my upload-scripts without using flash - and then they work fine. So from what I can tell, the flash upload object(s) and/or the javascript grabs the file - and screws the filename up somehow.

Has anybody encountered something similar - and maybe have an idea about how I can make this work as intended?


Solution

  • Most likely the SWFObject input sends UTF8 encoded data, and the script on the server side handles them as ISO-8859-1. For a quick fix (if you work with PHP on the server side), try utf8_decode() on the incoming filename.

    If I were you, I would think about simply filtering out all umlauts and converting them into their non-umlaut equivalents or "o", "a", "u". It makes life easier.