PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a file upload script which i have tested in Windows. I now need to move it to my UNIX server but i am having problems with this. Here is the relevant section of the code.
//absolute path on UNIX
$uploaddir = "uploads/";
//full path on Windows 5.1
//$uploaddir = 'c:\\Program Files\\Apache Group\\Apache2\\htdocs\'';
$upfile = $uploaddir. $_FILES['userfile']['name'];
if (!file_exists($uploaddir)){
echo "upload folder does not exists";
exit;
}
if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile)) {
echo "Problem: Could not move file into directory ";
exit;
}
I keep getting the error message
Warning:Unable to access uploads/test.xml in /users/cam/sbscs/myusername/.public_html/cgi-bin/myphpfile.php4 on line 54
Problem: Could not move file into directory
I definitely have a directory called 'uploads' under my cgi-bin directory. Any sugestion will be appreciated.
volka - I think the folder has write access in that i had ran the unix command "chmod 777 uploads" on it , which i believe will grant the folder read write and execute access. When i list the directory the security permission is "drwxrwxrwx".
devork - could you please suggest how i could "divide and conquer" this problem