Reputation: 1
When i am trying to store the image in folder.I can't able to store the image.it shows upload failed error message. Here i am using this code to store the image:
<?php
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['image']['name']);
echo "<p>";
if (move_uploaded_file($_FILES['image']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Upload failed";
}
echo "</p>";
echo '<pre>';
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
Upvotes: 0
Views: 49
Reputation: 5382
This could have many causes. Have you checked the upload file size limit in your php.ini? Both post_max_size
and upload_max_size
come to mind.
Also check the permissions on the directory you're moving them to.
Upvotes: 1