<?php
$target_dir = "form/";
$target_file = $target_dir . basename($_FILES["image0"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if(isset($_POST["submit"]))
{
$check = getimagesize($_FILES["image0"]["name"]);
if($check !== false)
echo "File is an image - " . $check["mime"] . ".\n";
else
{
echo "File is not an image.\n";
$uploadOk = 0;
}
}
To fragment mojego skryptu wysyłania maila z obrazkami.
A to fragment znacznika form:
<form method="post" action="../php/mail.php" ENCTYPE="multipart/form-data">
<label>Zdjęcia</label>
<div id="mail-images">
<input type="file" name="image0">
<input type="file" name="image1">
<input type="file" name="image2">
</div>
Dostaję taki błąd:
Warning: getimagesize(przed.png) [function.getimagesize]: failed to open stream: No such file or directory in /home/u542733629/public_html/php/mail.php on line 11
File is not an image. Sorry, your file was not uploaded. Letter is sent.
Jak mam to poprawić?