Jump to content

Is it possible to retain non-english filenames?


Recommended Posts

Quick question here:

Is it possible to upload files (in a files field) with non-english filenames and still retain the original filename?

I've tried to upload some files with Chinese file names (probably not the greatest idea), but after the upload completes the names simply turn into "1-20", or "doc.doc" etc. 

Would I have to download a language pack? (although one for Chinese doesn't exist yet)  

Link to comment
Share on other sites

I don't think it's possible to retain those filenames. ProcessWire converts file names to something that's universally web accessible, as well as compatible with the ProcessWire name format. It does this for both security and compatibility across servers. You could re-purpose or amend the description field as a filename and then use the wireSendFile() function with the 'downloadFilename' option to set to that custom filename. This way the file could be stored on the server in a compatible filename, while the file the user actually receives is named what you want it to be. It would take a little creativity and PHP in a template file, but if you feel up to it I can get you started. 

Link to comment
Share on other sites

Hmm, well right now the main reason I wanted to achieve this was
1) so that the client could easily see and organize what files he had uploaded among the name of files, and
2) possibly pull the filename (to echo) instead of having to type in a title in the "description" sub-field or a newly created title field. 

But currently for both I'm just using the simple workarounds of having the files renamed in English (if possible) and typing the original filename in the description sub-field. So I guess right now for time-savings and simplicity sake it may be a bit overkill to go for that method. 

But if the need comes up I'll PM you or post again. Thanks Ryan!!

I also guess it's good to have the original filename for SEO friendliness, though I'm not most concerned about that. Would this method you mentioned have the original filename show up in the file's URL?

mysite.com/path/to/filename_in_original_language.doc ?

Link to comment
Share on other sites

 Would this method you mentioned have the original filename show up in the file's URL?

Probably not. The URL itself would still have to be compliant with the standard URL character set, but the filename itself that appears on the user's computer could be different. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...