Ask the great God to see this code, upload the picture successfully, but can't find the picture?
Test the input
$photo _dir= '/var/www/images/';
if (!is_dir ($photo _dir) | | Is_writeable ($photo _dir)) {
Die (' No dir exist or can write ');
}
if ($_files[' picture '] [' ERROR ']>0) {
Echo ' ERROR: '. $_files[' picture ' [' Error ']. '
';
}
else{
echo "Upload:". $_files[' picture ' [' name ']. '
';
echo "type:". $_files[' picture ' [' type ']. '
';
echo "Size:". ($_files[' picture '] [' size ']/1024). ' Kb
';
echo "stred in:". $_files[' picture ' [' tmp_name ']. '
';
if (file_exists ('/var/www/images/'. $_files[' picture '] [' name ']))
{
echo $_files[' picture ' [' name ']. ' already exists ';
}
Else
{
$gpy =move_uploaded_file ($_files[' picture '] [' tmp_name '], '/var/www/images/'. $_files[' picture ' [' name ']);
if (gpy)
{
Echo ' Succed ';
}
Echo ' Stored in: '. ' Images/'. $_files[' picture ' [' name '];
}
}
?>
The code actually shows that the upload was successful, but I can't find the uploaded file in the file path I set?
------Solution--------------------
Do you want to double-check the files that are not actually uploaded under that path?
In addition, open the error prompt function, to see if there are any error messages during the upload process.
------Solution--------------------
Your images directory does not have normal user write permissions
You can view the post-submission page content, there must be no Succed words
------Solution--------------------
References:
Quote: References:
Quote: References:
Directory permissions problem, images folder to Www-data Write permission?
What is the authority you are referring to? I set the/var/www/image to the web, which is what I can read and write, right?
The Web is the user you created yourself, and the Apache username is Www-data
------Solution--------------------
if (gpy)
Obviously wrong.
should be if (