Upload Images On Server
Solution 1:
Always add check to make sure you are actually getting something,
You can make use of is_uploaded_file Try it like this:
<?php
if(is_uploaded_file($_FILES['uploaded_file']['tmp_name']){
//we got something, set it up
$target_path1 = "uploads/";
$file = basename( $_FILES['uploaded_file']['name']);
$full_path = $target_path1.$file;
//perform the upload
if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $full_path)) {
echo "The first file ".$file." has been uploaded.";
} else {
echo "There was an error uploading the file, please try again!";
echo "filename: " . $file;
}
}else{
echo "Nothing was uploaded";
}
?>
Solution 2:
put:
<?php
var_dump($_FILES);
exit;
just on the beginning of a file and check what is there. You have wrong key in your array. Check what is the correct key of your input file.
Post a Comment for "Upload Images On Server"