I have website where I create a file from a form. The user have to write a comapany name and it will create a folder with the company name and save the company name inside my Database, later when some steps are made on my website here is an exemple how I create a folder :
$folder_name = format_folder_name($entreprise->getNom());
$path_file = $path_upload . '/' . $folder_name;
createFolderIfNotExist($path_file);
Recently I had a case where the company is "LALAL & OMOMO" (fake name of course ^^) One folder I've been created correctly but for some reasons it can't work correctly because of the "&" inside the company name. When I want to reuse the folder inside my code it can't find id beacause of what is after the "&" and it is consider as a diffrent command.
how could I save and create folders correctly with the & inside my folder name ? (I don't want to change company name).
here is an exemple from when i want to upload the company logo :
// create folder company name if not exist
$entreprise_folder_name = format_folder_name($_POST["create_entreprise_nom"]);
$path_file = $path_upload . '/' . $entreprise_folder_name;
createFolderIfNotExist($path_file);
// create folder "Logo" if not exist
$path_file .= "/Logo";
createFolderIfNotExist($path_file);
And when I take a look to the folder I have to folder with my company name
- LALAL_&_OMOMO
- LALAL__OMOMO
The logo is saved in the second folder
I'm affraid to have the same case with some others caracters like " ' " for example.