Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Upload files with non-standard characters as filename (hebrew)


7 Posts   2197 Views


16 July 2010 at 12:25am (Last edited: 16 July 2010 1:02am), Community Member, 13 Posts

Hi everyone.
first let me start by saying that i LOVE silverstripe. i am using it to develop an internal intranet for my company. i have successfully made a right to left theme and have hebrew displaying perfectly except for one thing.

when i upload files with hebrew names (an absolute necessity) the upload completes successfully, but it strips all he hebrew characters out of the file name. this is a problem because there are many workers here that don't read english. i must be able upload files with hebrew names, and have them display correctly. if anyone has any advice, i would most appreciate it.

i have already set the collation in the "FILES" table in the db to utf8_unicode_ci (as per several other webapps that had similar problems) but that did not help.

UPDATE: after i upload the file, and all the hebrew characters are stripped out, i can edit the title and filename and then the hebrew will show up. this leads me to believe that there is some form of character validator that is stripping out characters. can anyone tell where i might find this?


19 July 2010 at 12:46am Community Member, 13 Posts

bump - PLEASE help me.....i must bypass filename validation!!!!!


19 July 2010 at 1:34am Forum Moderator, 1796 Posts


function load($tmpFile, $folderPath = false)

      // Generate default filename
      $fileName = str_replace(' ', '-',$tmpFile['name']);
      $fileName = ereg_replace('[^A-Za-z0-9+.-]+','',$fileName);
      $fileName = ereg_replace('-+', '-',$fileName);
      $fileName = basename($fileName);

I'd say it was '$fileName = ereg_replace('[^A-Za-z0-9+.-]+','',$fileName);' causing your issue, you could remove this but I have no idea of implications this would have...

good luck...



19 July 2010 at 1:41am Community Member, 13 Posts

thanks for the reply. i tried this, and it had no effect...any other suggestions?


19 July 2010 at 2:00am Forum Moderator, 1796 Posts

where is the 'file name' that you can see with the problem? is it the name on the disk, the name in the CMS - if so where do you see and then edit this name. Also where are you doing the upload - what steps?

I simply searched for new File() and then supposed on that - that more info you give the more help you might get :)


19 July 2010 at 2:19am (Last edited: 19 July 2010 2:20am), Community Member, 13 Posts

i am uploading the files via the admin panel files & images under the upload tab
i select the file(s) to upload, they are word docs with hebrew names e.g. ????7.1.10.doc. the upload completes successfully and under files i have only 7.1.10.doc as the filename - the hebrew was stripped out of the file name. if i then click edit, i can re-add the hebrew part of the name, but it will only show up under title...the filename field will only accept english characters and numbers.


20 July 2010 at 2:15am (Last edited: 20 July 2010 2:29am), Community Member, 13 Posts

1 problem solved...on irc they recommended that i comment out

$file = ereg_replace('[^A-Za-z0-9+.-]+','',$file);

line 194 in file folder.php (saphire\filesystem)

now the filename is showing up perfectly, but the link does not work. there must be some encoding issue because when i link the file to download, the browser is looking for a filename in hebrew(as it should) but the browser wants %d2%d7%d5 etc. can anyone help? i am so close to perfection on this. Everything in the site/database is utf8. i also tried windows-1255 and iso-8859-8 with no change

ok, after much digging, i believe this is a urldecode problem with tinymce. i am looking at line 93 of htmleditorfield.php

   $candidateFile = File::find(Convert::raw2sql(urldecode($href)));

but i don't really know what to do with this. i found a site

that when i plug in the encoded string:


it returns me the correct file name. tinymce is apparently encoding the link "incorrectly" i hope this is clear and someone can help. thanks