Ok..ho provato a togliere entrambi gli if e stavolta entra.
Il problema adesso è che "non cattura" piu l immagine:
Codice PHP:
$filename= null;
error_reporting(E_ALL);
$error_message = "";
if($_SERVER["REQUEST_METHOD"] == "POST"){
$dir= "/imageupload/";
// Check if the form was submitted
// Check if file was uploaded without errors
$allowed = array("jpg" => "image/jpg", "jpeg" => "image/jpeg", "gif" => "image/gif", "png" => "image/png");
echo '<script type="text/javascript">alert("ENTRATO NELL IF");</script>';
$filename=$_FILES["photo"]["name"];
echo '<script type="text/javascript">alert("'.$filename.'");</script>';
$filetype = $_FILES["photo"]["type"];
$filesize = $_FILES["photo"]["size"];
// Verify file extension
$ext = pathinfo($filename, PATHINFO_EXTENSION);
if(!array_key_exists($ext, $allowed)) die("Error: Please select a valid file format."); // MI RESTITUISCE QUESTO ERRORE!!!