View Full Version : Upload not working

07-19-2004, 05:21 AM
$uploaddir = $_POST['dir'];
$uploadfile = $uploaddir . $_FILES['userfile']['name'];

echo "No file specified to upload.";
elseif(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
echo "File was successfully uploaded!";
echo "File was not uploaded.";
} and my form
<form enctype="multipart/form-data" action="<?php echo $cfg['self']; ?>" method="POST" style="margin: 0;">
<input type="hidden" name="MAX_FILE_SIZE" value="1073741824" />
<input type="file" name="userfile" style="font-size: 8pt;" size="30" />
<input type="submit" value="Go" name="upload" style="font-size: 8pt;" /><br />
<input type="hidden" name="dir" name="dir" value="<?php echo $cfg['dir']; ?>" />

It fails to upload, but gives no error. Any help?

07-19-2004, 09:35 AM
i don't immedeately see anything wrong.

my first idea would be that you have a windowsstyles dirname (with backslashes) while you upload to a *nix wich needs forwardslashes.
or that you (well the webserver) doesn't have writepermission for the directory you write to.

Try echoing out the adress.