I have a PHP application.
I allow users to upload files to my web application.
Question: What\'s the best way for me to sanitize the file n
Ciao, this function also removes all the points and then I create the clean string with the extension.
function sanitaze_upload_file($data)
{
$imgName = $data;
$indexOFF = strrpos($imgName, '.');
$nameFile = substr($imgName, 0,$indexOFF);
$extension = substr($imgName, $indexOFF);
$clean = preg_replace("([^\w\s\d\-_~,;\[\]\(\)])", "",
$nameFile);
$NAMEFILE = str_replace(' ', '', $clean).$extension;
return $NAMEFILE;
}