PHP Help! (SOLVED)


#1

This is the code i use:

<?php $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $uploadOk = 1; $imageFileType = strtolower(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 "It's fanART. (Not a picture format)"; $uploadOk = 0; } } // Check if file already exists if (file_exists($target_file)) { echo "There can only be one of those. (Already exists)"; $uploadOk = 0; } // Check file size if ($_FILES["fileToUpload"]["size"] > 500000) { echo "YO! Your pic is great, but it's too heavy for us to carry. (File size too large)"; $uploadOk = 0; } // Allow certain file formats if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif" ) { echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed."; $uploadOk = 0; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { echo "Umm....this is akward.....it kinda sorta maybe wansn't uploaded"; // if everything is ok, try to upload file } else { if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) { echo "You picture, ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded."; } else { echo "Umm....this is akward.....we kinda can't upload it"; } } I keep getting this error File is an image - image/png. Warning: move_uploaded_file(uploads/happy monika (get it bc honica rhymes with monika.....i celeberate christmas.....).png): failed to open stream: No such file or directory in /storage/ssd3/509/3965509/public_html/upload.php on line 38 Warning: move_uploaded_file(): Unable to move '/storage/ssd3/509/3965509/tmp/phpbsZQLi' to 'uploads/happy monika (get it bc honica rhymes with monika.....i celeberate christmas.....).png' in /storage/ssd3/509/3965509/public_html/upload.php on line 38 Umm....this is akward.....we kinda can't upload it Can some one tell me what's wrong?