Alright. This thing is driving me crazy. All i'm trying to do is upload an image using a form with a file input field. Everything works except when I try to copy the file from the /tmp directory to this directory /home/httpd/vhosts/tranquiliti.net/httpdocs/biographies/pictures/ . The /tmp directory and the /home directory are in the same folder. I've tried specifying the directory to copy to in relation to the /tmp directory, in relation to the /httpdocs directory, in relation to the page where teh upload is submitted from, and I can't get it to work. Any help would be greatly appreciated. Here is my code.
if($adduser==1){
if($picture=='none')
{
echo "Problem: no picture uploaded";
exit;
}
if($picture_size=='0')
{
echo "Problem: uploaded file is zero length";
exit;
}
if($picture_type !='image/pjpeg' && $picture_type !='image/jpeg')
{
echo "Problem: file is not a web acceptable picture format. Go <a href='bioadmin.php'>back</a> and try again.";
}
$upfile = '/home/httpd/vhosts/tranquiliti.net/httpdocs/biographies/pictures/' . $picture_name;
if (!copy($picture, $upfile))
{
echo $picture_name . "<br>";
echo $picture_type . "<br>";
echo $picture . "<br>";
echo "Problem: could not move file into directory";
exit;
}
}
echo "<form method='post' enctype='multipart/form-data' action='bioadmin.php'>";
echo "Add User: <input type='checkbox' value='1' name='adduser'><br>";
echo "Upload Picture:";
echo "<input type='hidden' name='MAX_FILE_SIZE' value='450000'><input type='file' name='picture'><br>";
echo "<input type='submit' value='Add User'> <input type='reset' value='Reset'>";
echo "</form>";
I essentially copied the error checking code and the copy code from a book that I'm using, since I've never used the upload function before. I've also attached the entire file if you care to look at it.