How to replace special characters in file names?
It looks like there is no replacement for critical charcters in filename when uploading and saving them to database. I need to replace öüäéèà. How do I achieve this? Thanks for any help
It looks like there is no replacement for critical charcters in filename when uploading and saving them to database. I need to replace öüäéèà. How do I achieve this? Thanks for any help
edit the webassist/file_manipulation/helperphp.php
change line 81:
$baseFileName = preg_replace('/\.[^.]*$/', '', $uploadedFile["name"]);
to:
$baseFileName = preg_replace('/\.[^.]*$/', '', $uploadedFile["name"]);
$baseFileName = str_replace(array("ö","ü","ä","é","è","à"), '', $baseFileName);
I'm afraid this doesn't seem to work. I have the following code implemented:
$baseFileName = preg_replace('/\.[^.]*$/', '', $uploadedFile["name"]);
$baseFileName = str_replace(' ', '', $baseFileName);
$baseFileName = str_replace(array("ö","ü","ä","é","è","à"), '', $baseFileName);
It removes spaces but not the special characters. Also this is not working:
$baseFileName = preg_replace('/\.[^.]*$/', '', $uploadedFile["name"]);
$baseFileName = str_replace(array(' ',"ö","ü","ä","é","è","à"), '', $baseFileName);
This also removes the spaces in the filename but not the special characters
I'll need to troubleshoot directly, see the private message section.
I corrected the problem by using the following code on the update page:
<?php
if(isset($_FILES['Foto'])) {
$_FILES['Foto']['name'] = str_replace(array("ö","ü","ä","é","è","à"," "), '', $_FILES['Foto']['name']);
}
?>
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.