Hello everyone! I'm still a newbie to PHP but I'm experienced with several other scripting languages and think I'm picking up php pretty easily. But I'm having problems uploading a file and then moving that file to where my web server can access it. The page I'm writing is kinda long so I'll just post the form field and then the php script to move the file. So, here goes:
<?php
if ($submit) {
$filepath = "/var/www/html/Images/coraldb/$Picture_name";
if (move_uploaded_file($Pictures_tmp_name,$filepath)) {
print "File is there, moving to $filepath";
}else{
print "File is not there, no action performed";
print_r($_FILES);
}
//everything else from here to the below else statement is to put the values in the database which is working
} else{
echo "
<form enctype='multipart/form-data' action='$PHP_SELF' method='post'>
<input type='hidden' name='max_file_size' value='50000000'>
Picture:
<input type='File' name='Picture' size='25'>"
}
?>
All of the variable names show up correct, but the move_uploaded_file is failing, when I go look in the upload dir the file isn't there (I look for the temp file name which is different than the uploaded file name). All of the $FILES array variables are correct and the $FILES['Picture']['error'] variable contains a 0. I've also checked the php.ini file to ensure uploads is turned on and I have set the appropriate post size also. Any ideas what I'm doing wrong? Any help would be greatly appreciated.
Thanks in advance,
Keith Strickland
http://www.keithstric.com