Koozali.org: home of the SME Server

PHP File Uploads

Con

PHP File Uploads
« on: June 24, 2003, 05:09:13 AM »
I can't seem to Upload files onto the server using PHP. I have tried turning off the Sandbox feature which has removed one of the error messeges I was getting, however, I still am unable to use copy() to move the file. This is the error message I am getting from PHP:

Warning: Unable to open '' for reading: No such file or directory in /home/e-smith/files/primary/html/inc/admin.inc on line 575
Problem: Image file could not be moved into the proper directory

And this is the section of PHP Code which it is complaining about:

$file_path = "/home/uploads/". $imagefile_name;
if(!copy($imagefile, $file_path))
{
echo "Problem: Image file could not be moved into the proper directory";
return false;
}

The directory exists and has 40777 rights. What have I done wrong?

Guck Puppy

Re: PHP File Uploads
« Reply #1 on: June 24, 2003, 11:31:42 AM »
The php warning indicates the $imagefile variable is blank (empty).

Did you already review the
http://www.php.net/manual/en/features.file-upload.php
page?

G

Con

Re: PHP File Uploads
« Reply #2 on: June 25, 2003, 06:45:13 AM »
Thanks for the link Guck. I have read through the problems that the others have had and I'm still having some difficulties. I have set the MAX_FILE_SIZE to 4000000 to avoid any problems of file size from the browser.

I have tried printing the $_FILES array using:

print_r($_FILES);

and the array is empty:

Array( )       // Msg show in browser

My php.ini file has the following settings:

upload_max_filesize = 2M
upload_tmp_dir = /home/uploads
file_uploads = On
post_max_size = 8M

register_globals = On

These are the only settings I can think of that would affect the ability to upload. Any other Ideas?