php - uploading the name of the images -
i'm uploading name of images database!
the problem name in database blank space before name!
where problem?
$original_name = strtolower(trim($arquivo['name'])); $caracteres = array("ç","~","^","]","[","{","}",";",":","´",",",">", "<","-","/","|","@","$","%","ã","â","á","à","é", "è","ó","§","ò","+","=","*","&","(",")","!","#","?", "`","ã"," ","©","£"); $original_name = str_replace(' ', '', $original_name); $final_name = str_replace($caracteres,"",$original_name);
i suggest use white list of allowed characters such [a-za-z0-9_]
and use:
$final_name = preg_replace("#[^a-z0-9_]+#i", "", $arquivo['name']);
Comments
Post a Comment