I am developing an application with html5 , css3 , jquery and php , and I have the problem that when I want to upload a png image, it does not upload it to the server. I can upload images jpg, bmp, but when the image is png it seems that it does not detect it. Any idea why this happens?
This is the code that you use: the temporary file if you create it but do not upload it, it seems that the problem is in the mov_upload statement. The strange thing is that if it works with other types of images. the problem is just "png"
//revisa si viene imagen
if ($_FILES["archivo"]["name"]!=""){
echo $_FILES["archivo"]["type"];
//verifica tipo de imagen, capturando la extension del nombre del archivo
//vrifica la posocion del punto (.), para los archivos jpeg
$ext=substr($_FILES["archivo"]["name"], -4);
if (substr($_FILES["archivo"]["name"], -4, 1)!="."){
$ext=substr($_FILES["archivo"]["name"], -5);
}
$ext=substr($ext, 1); //quita el punto de la extension
if($ext=="jpeg" or $ext=="jpg" or $ext=="bmp"){
$imagen=time() . ".$ext";
$destino="media.image/publicacion/" . $imagen;
$archivo=$_FILES["archivo"]["tmp_name"];
move_uploaded_file($archivo, $destino);
}
}