Who owns the directory you are uploading to? Must be set the
same to the same user the apache web server is set to and also
check the directory permissions. Apache must be able to write to
it.
you may also want to study the $_FILES array on PHP. I use it all
the time. for example if you have a file box on a upload form with the name "pcfile".
$FILES['pcfile']['type'] => MIME type of the file
$FILES['pcfile']['name'] => original file name
$FILES['pcfile']['tmp_name'] => filename and path of the tmp file
$FILES['pcfile']['size'] =>size of the file
And also watch out for the enctype on the upload form it must
be 'multipart/form-data'.
To make it easier for you. here is some code:
upload.html
###################################
<html>
<body>
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="pcfile">
<input type="submit">
</form>
<body>
</html>
###################################
upload.php
###################################
<?php
//echo out all the contents of $FILES['pcfile']
while(list($key, value) = each($FILES['pcfile']))
{
echo $key.':'.$value;
}
copy($FILES['pcfile']['tmp_name'], "/path/to/file/".$FILES['name']);
?>
###################################