|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
replacing specail chars in filenames
Hi,
How do I replace certain 'special' characters with a '_' in php ??? I need to replace @£!$%^^%&(*) etc as jpegs won't load in flash if they have any of these characters in there. If I convert them to unicode will that work ?? I could convert them to unicode after they're saved in the php file that outputs the XML file that flash parses, but I don't know if you can have unicode in filenames. Any ideas ?? Thanks in advance, Jon |
|
#2
|
|||
|
|||
|
I've just checked on the server and it's replacing any of these chars with a '_' itself, but the php is storing the filename in the DB with the @ so the filename is wrong, dam.
Jon |
|
#3
|
|||
|
|||
|
Hey, i suggest you use make a md5 hash of the filename.
in php i would look something like this: $filename = "anyfile.jpg"; $md5filename = md5($filename); if (!copy($filename, $md5filename)) { die("failed to copy $filename..."); } that way, you can parse the filename anywhere and if you need a random filename then replace $md5filename with this: $md5filename = md5(uniqid(rand(),1)); (though i don't think it will be usefull in your case) hope it helped you! |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > replacing specail chars in filenames |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|