Hi,
I'm trying to get file uploads working, but can't get the directory right for use with the copy() function - I have checked the manual and user notes, but as it is server/host specific, it is causing much grief!
The upload form passes the filename to the file doupload.php
<?php
echo "Filename : " . $_FILES['userfile']['name'];
echo "<br>";
echo "Type : " . $_FILES['userfile']['type'];
echo "<br>";
echo "Size : " . $_FILES['userfile']['size'];
echo "<br>";
echo "Tempname : " . $_FILES['userfile']['tmp_name'];
echo "<br>";
echo "Error : " . $_FILES['userfile']['error'];
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
echo "<br>Uploaded!<br>";
copy($_FILES['userfile']['tmp_name'], "/home/sites/site57/web/uploads/files/" . $_FILES['userfile']['tmp_name'])
or die("<br>FAILED!<br>");
} else {
echo "Possible file upload attack. Filename: " . $_FILES['userfile']['name'];
}
?>
This seems to work fine, but then returns the following message...
Filename : img.jpg
Type : image/pjpeg
Size : 30829
Tempname : /tmp/phpJJ6uMb
Error :
Uploaded!
Warning: Unable to create '/home/sites/site57/web/uploads/files//tmp/phpJJ6uMb': No such file or directory in /home/sites/site57/web/uploads/doupload.php on line 14
FAILED!
I've tried this with a load of different directories,but no luck. If phpinfo states my DOCUMENT_ROOT to be /home/sites/site57/web then can this be translated to copy the temp file into the /uploads/files/ directory of my domain?
Thanks,
week