Hi, I have this code that I have been able to assemble, I only upload the images, but when I select a pdf file, it is not saved in the indicated folder, they could tell me what my error would be, this is what I have
function AgregarRecepcionCertificado(){
$Recepciones= new Recepciones();
$tipoArchivo=explode("/",$_FILES["archivo"]["type"]);
$ubicacion="ARCHIVOS_FOODZ\CERTIFICADO_SENASA";
$Recepciones->n_item=$_REQUEST["item"];
$Recepciones->NumRecepcion=$_REQUEST["NumRecepcion"];
$Recepciones->IdProveedor=$_REQUEST["IdProveedor"];
$Recepciones->IdCoordinador=$_REQUEST["IdCoordinador"];
$Recepciones->CodProducto=$_REQUEST["CodProducto"];
$Recepciones->Chofer=$_REQUEST["Chofer"];
$Recepciones->NomImagenR=$ubicacion."/".$_REQUEST["NomImagen"].'.'.$tipoArchivo[1];
$Recepciones->NomImagen=$_FILES['archivo']['name'];
$nombre_img=$_FILES['archivo']['name'];
if (($_FILES['archivo']['name'] == !NULL) && ($_FILES['archivo']['size'] <= 500000))
{
//indicamos los formatos que permitimos subir a nuestro servidor
if (($_FILES["archivo"]["type"] == "image/gif")
|| ($_FILES["archivo"]["type"] == "image/jpeg")
|| ($_FILES["archivo"]["type"] == "image/jpg")
|| ($_FILES["archivo"]["type"] == "image/png")
|| ($_FILES['archivo']['type'] == "application/pdf")
)
{
//$foto=$ubicacion."/".$cant.".jpg";
$NomImagenR=$ubicacion."/".$_REQUEST["NomImagen"].'.'.$tipoArchivo[1];
// Muevo la imagen desde el directorio temporal a nuestra ruta indicada anteriormente
move_uploaded_file($_FILES['archivo']['tmp_name'],$NomImagenR);
}
else
{
//si no cumple con el formato
echo "No se puede subir una imagen con ese formato ";
}
}
else
{
//si existe la variable pero se pasa del tamaño permitido
if($_FILES['archivo']['name'] == !NULL) echo "La imagen es demasiado grande ";
}
$data=$this->recepciones->RegistrarRecepcionCertificado($Recepciones);
echo(json_encode($data));
}