image file upload to folder PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

image file upload to folder PHP

code looks like this idk why the error is happeneing now it was working the fist couple of uploads i did and now nothing just error after error error message is the one that says error with the upload man <?php if(isset($_POST['submit'])){ $file = $_FILES['file']; $fileName = $_FILES['file']['name']; $fileTmpName = $_FILES['file']['tmp_name']; $fileSize = $_FILES['file']['size']; $fileError = $_FILES['file']['error']; $fileType = $_FILES['file']['type']; $fileExt = explode('.', $fileName); $fileActualExt = strtolower(end($fileExt)); $allowed = array('jpg','jpeg', 'png', 'mp4', 'mp3'); if (in_array($fileActualExt, $allowed)) { if ($fileError === 0) { if ($fileSize < 100000000) { $fileNameNew = uniqid('', true).".".$fileActualExt; $fileDestination = '../uploads/images/'.$fileNameNew; move_uploaded_file($fileTmpName, $fileDestination); header("Location: add.php?ready_to_upload_post"); }else{ echo "file to big bruh";} }else{ echo "error with the upload man";} }else{echo "not a file type my dude";} } ?>

19th Oct 2018, 4:45 PM
D'Mairis Edwards
D'Mairis Edwards - avatar
3 Answers
0
error with the upload man
19th Oct 2018, 9:56 PM
D'Mairis Edwards
D'Mairis Edwards - avatar
0
that's the one that shows
19th Oct 2018, 9:56 PM
D'Mairis Edwards
D'Mairis Edwards - avatar
0
i found it is the file size that seems to be the problem it won't allow anything over 2mb
19th Oct 2018, 9:57 PM
D'Mairis Edwards
D'Mairis Edwards - avatar