file upload problem. using PHP and HTTP POST

jbenda

New member
Joined
Mar 31, 2006
Messages
2
Location
Netherlands
I'm trying to upload files to my homepage using a FORM. On several servers I tried the code at it works but on my production server, which I can configure using DirectAdmin, it doesn't work. The code I use is very simple:

if (isset($_POST['Submit'])) {
$s = $HTTP_POST_FILES['yFile']['name'];
if (!@move_uploaded_file($HTTP_POST_FILES['yFile']['tmp_name'],$dir.$s)) {
$errorupl = "t";
} else {
$errorupl = "f";
}
}

$dir has been set to:
{$_SERVER['DOCUMENT_ROOT']}
which evaluates to (username is of course mine, as is the mydomain.com):
/home/myusername/domains/mydomain.com/public_html/

No matter what type of file I upload, I always get and error ($errorupl=="t")

I've tried to get the error type using
$HTTP_POST_FILES['yFile']['error']
but it returns 0.

Am I doing something wrong? Do I need to set something in DA so I can upload files? Do I need to ask my provider to set it up?

Any help would be appreciated.

Jeroen
 
Try removing the "@" in front of move_uploaded_file so you can see the php error message. Maybe that way you can find out why it fails.
 
Back
Top