PDA

View Full Version : File Upload Problem with PHP



Niaad
December 22nd, 2001, 15:42
I'm attempting to make a script that will allow users to upload files. I already have the form worked out fine (with the browse button opening up the file selection window), and the variables are coming through fine ($ufile_name, $ufile_size, ect.)...but I can't seem to get PHP to physically move the file from the temporary directory.

I am wondering if this is simply a restriction my host as imposed, since I am hosted by Cedant (www.cedant.com) :nervous:. Anyway, here's the code I'm using:


move_uploaded_file("$ufile", "/home/niaad/niaad-www/members");

I am getting this error message:

Warning: Unable to create '/home/niaad/niaad-www/members': Is a directory in /home/niaad/niaad-www/fc/upload.php on line 110

Warning: Unable to move '/tmp/phprgnvhp' to '/home/niaad/niaad-www/members' in /home/niaad/niaad-www/fc/upload.php on line 110

That was from when I attempted to upload a file "asdf.gif". I have tried replacing the "move_uploaded_file" function with simply the copy function, and then instead I get this:

Warning: Unable to create '/home/niaad/niaad-www/members': Is a directory in /home/niaad/niaad-www/fc/upload.php on line 110

If this is in fact a host issue, please let me know...so I can stop trying :/. Otherwise if anybody has any idea what's wrong, please post it.

niv
December 22nd, 2001, 15:44
move_uploaded_file("$ufile",-"/home/niaad/niaad-www/members/$ufile");

Niaad
December 22nd, 2001, 15:50
Ah, I got it working. Had to do two things:

- CHMOD the folder I was trying to copy the file to 777

- copy("$ufile", "'/home/niaad/niaad-www/members/$ufile_name");