Qualcuno può dirmi perché, quando si seleziona un file psd, l'istruzione if nel codice php passa come true ed echos "image/vnd.adobe.photoshop"?se l'istruzione restituisce true
<?php
if (isset($_POST['submit'])) {
foreach ($_FILES["myimages"]["error"] as $key => $error) {
$tmp_name = $_FILES["myimages"]["tmp_name"][$key];
$name = $_FILES["myimages"]["name"][$key];
$imagetype = $_FILES['myimages']['type'][$key];
if ($imagetype == "image/jpeg" || "image/gif") {
echo $imagetype;
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" enctype="multipart/form-data" action="<? echo basename(__file__); ?>">
<input type="file" name="myimages[]" multiple>
<input name="submit" type="submit" value="submit">
</form>
</body>
</html>
Come suggerimento generale: puoi abilitare le ispezioni nella maggior parte degli IDE moderni che si lamenteranno di cattive condizioni come 'if (" foo ") {' sarai costretto a scrivi 'if (" foo "=== true") {'(che è' false') che rende più facile individuare questi errori. – Halcyon