hey guys i am practicing how to upload data but this script runs successfully and shows file is an image. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

hey guys i am practicing how to upload data but this script runs successfully and shows file is an image.

but when i check the folders "upload" there are no files uploaded there . please guys any help would be appreciated. <!DOCTYPE html> <html> <body> <form action="process.php" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form> </body> </html> //process.php file <?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["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["fileToUpload"]["tmp_name"]); if($check !== false) { echo "File is an image - " . $check["mime"] . "."; $uploadOk = 1; } else { echo "File is not an image."; $uploadOk = 0; } } ?>

15th Nov 2017, 1:02 PM
Franklyn Omeben
Franklyn Omeben - avatar
1 Answer
+ 1
on a computer of course using xampp server
15th Nov 2017, 9:33 PM
Franklyn Omeben
Franklyn Omeben - avatar