Hello fellow programmers,
I've built an upload script that, as usual, verifies if a file extension is allowed. However, the comparison seems to not be working, as it gives me an unhauthorized file trying to be uploaded (when in fact the file has an authorized extension).
If i comment the block below, the upload works fine
Anyone could give me a hint?
//Array containing the authorized extensions $ext_permitidas = array("jpg","jpeg","gif","png"); /* SOME CODE HERE */ //String comparison and validation $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); if(!in_array($ext,$ext_permitidas)) die('A extensão da imagem '.$ext.' não é permitida');