ok here’s the code:
This is my first time attempting to upload files… with php
[php]
The upload script
[php]
". PHP_EOL; $error = true; } if(!ctype_digit($ID)){ $msg .= "ERROR: ID is not of thou art numerical value" . PHP_EOL; $error = true; } if(file_exists($ID.$IMGTYPE)){ $msg .= "ERROR: ID is not of thou art existance" . PHP_EOL; $error = true; } if($IMGTYPE != "jpg" || $IMGTYPE != "png" || $IMGTYPE != "gif" || $IMGTYPE != "jpeg"){ $error = true; $msg .= "File MUST be jpg, png, jpeg, or gif!
" . PHP_EOL; } if(!$error){ //if no errors then upload file //grab whole $Avatar_DB = $ID.".".$IMGTYPE; // move_uploaded_file($_FILES['Avatar']['tmp_name'], "Avatars/".$ID.".".$IMGTYPE) or die("File not uploaded"); //connect to DB require_once("../Scripts/DB/connect.php"); //create a query to update the avatar $Query = $connect->prepare("UPDATE Users SET Avatar=:avatar"); $Query->bindValue(":avatar", $Avatar_DB); $Query->execute() or die("Image Unsuccessful"); $User = $_SESSION['Logged_in']; header("Location: ./profile.php?user=$User&&id=$ID&&upload=true"); exit(); } else { echo "
.$msg.
"; } ?>[/php]
I get the file not uploaded script.