<?php
$statusMsg = '';

// File upload path
$targetDir = "fotos/";
$fileName = basename($_FILES["foto"]["name"]);
$targetFilePath = $targetDir . $fileName;
$fileType = pathinfo($targetFilePath,PATHINFO_EXTENSION);

if(!empty($_FILES["foto"]["name"])){
    // Allow certain file formats
    $allowTypes = array('jpg','png','jpeg','gif','pdf');
    if(in_array($fileType, $allowTypes)){
        // Upload file to server
      move_uploaded_file($_FILES["foto"]["tmp_name"], $targetFilePath);
}
}
 ?>