0
I have the following code to upload an image:
var_dump ( $_FILES );
$target_dir = "uploads/";
$target_file = $target_dir . basename ( $_FILES ["fileToUpload"] ["name"] );
$uploadOk = 1;
$imageFileType = pathinfo ( $target_file, PATHINFO_EXTENSION );
if (isset ( $_POST ["submit"] )) {
$check = getimagesize ( $_FILES ["fileToUpload"] ["tmp_name"] );
if ($check !== false) {
echo "File is an image - " . $check ["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not an image.";
$uploadOk = 0;
}
}
but nevertheless the following error appears when I upload the image: array(1) { ["fileToUpload"]=> array(5) { ["name"]=> string(8) "css3.jpg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(14) "/tmp/php8UjGak" ["error"]=> int(0) ["size"]=> int(21455) } File is an image - image/jpeg.
That’s not a mistake, it’s a way out
var_dump()
– rray
rray what should I do then?
– Diana Madeira
Just remove the
var_dump()
– rray
rray removed and it worked, but I click "choose file" I choose the photo and then click upload, so I just want the file to appear as having been uploaded, however it does not happen to appear a blank page with the echo information. have as Voce help me pf? thanks, pf see the image, I just added
– Diana Madeira
When writing the message send the formatted html, then you play the message inside a div with the formatting classes.
– rray