• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

File Upload Problem with PHP

Niaad

New Member
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:

PHP:
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.
 
move_uploaded_file("$ufile", "/home/niaad/niaad-www/members/$ufile");
 
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");
 
Last edited:
Back
Top