PHP File Uploads

PHP File Uploads

Posted by: Abyss
Posted on: 2007-02-01 09:45:00

Hello.
I'm a dreamhost customer, working on my site. I just learned PHP and MySQL recently, and I'm having somewhat of an issue.

I've been trying to add FTP-like features to my users on my site (Not actual FTP access, but file uploading/downloading/etc features through PHP Scripts).

I'm trying to get a successful file upload, but it's not working. I used this tutorial to make my script: http://us2.php.net/features.file-upload

When I use the script, I keep getting a false return on move_uploaded_file(); The source I am using to do this is here: http://www.voidinput.com/upload.phps

Does anyone know what I could be doing wrong, or if it's something in Dreamhost I'm unaware of?

Thanks! -Abyss

-vI-

Re: PHP File Uploads

Posted by: scjessey
Posted on: 2007-02-01 13:30:00

I cannot see anything wrong with your script. Did you set the correct permissions for the folder you are writing to?

Re: PHP File Uploads

Posted by: Abyss
Posted on: 2007-02-01 18:18:00

Well, at first, I tried creating the folder through php, it is said that using mkdir in php makes the folder have a default permissions of 0777 (All Access to Everyone). It didn't work, so I chmodded all of the parent folders up to that, that I could, and it still was unable.

I can try again, I guess...

EDIT: I tried. It didn't work. Anyone else have any ideas, or experience with this? Has anyone else ever succesfully used a fileupload in PHP?

-vI-Edited by Abyss on 02/01/07 06:28 PM (server time).

Re: PHP File Uploads

Posted by: ardco
Posted on: 2007-02-01 18:48:00

In reply to:

0777


Ooh. That rings a bell. Don't you need 755 for directories, or is that old news?

Re: PHP File Uploads

Posted by: Abyss
Posted on: 2007-02-05 17:46:00

Tried, still not working :/

Anyone else have any clue?

Does anyone have experience with these kinds of scripts actually working?

-vI-

Re: PHP File Uploads

Posted by: wholly
Posted on: 2007-02-05 19:29:00

(obligatory off-topic and useless post)

Call 007!

Wholly

Re: PHP File Uploads

Posted by: silkrooster
Posted on: 2007-02-05 21:28:00

I could not see where $path['root'] was set to a value.
Silk

My website

Re: PHP File Uploads

Posted by: nathan823
Posted on: 2007-02-05 21:44:00

try this:

$uploadfile = getcwd() . "/users/" . $_SESSION['username'] . "/" . basename($_FILES['userfile']['name']);

Note getcwd() returns the current working directory

Re: PHP File Uploads

Posted by: Mustikos
Posted on: 2007-02-06 10:21:00

Hey Rooster..

Just wondering.. do you use Infini-D from Metacreations?


in regards to your form, void.... when I get some time later, I'll see what I can't figure out....

Re: PHP File Uploads

Posted by: silkrooster
Posted on: 2007-02-06 21:23:00

I don't beleive I know of that program
Silk

My website

Re: PHP File Uploads

Posted by: Abyss
Posted on: 2007-02-07 21:19:00

It is set previously. Located in the configuration, but it is set to the correct directory of my http files. (I verified this many times, plus, other parts of the site rely on this and work).

I'm still clueless, I'll try using the function, but I have a feeling that won't work.

-vI-

Tags: file uploaddreamhostfile uploadingfile uploadsphp scriptsftp accessphp fileuploaded