I have a script that uploads files to a folder and it works lovely when im testing on my XAMPP box, if someone else tries to upload it says
Warning: copy(C:/xampp/htdocs/data/mottramg/AEGON.jpg): failed to open stream: No such file or directory in C:\xampp\htdocs\training\upload.php on line 27
Could not copy file.
now this tells me, it can see where to copy the file too, but cant find the temp file? script is below:
<?php
$directory = $_GET['dir'];
$phpbbdir = "/data/" . $directory . "/";
// Set the maximum uploadable file size => 512000 = 500kb
$maxfilesize = 512000;
// Is the file larger than it is allowed to be?
if($_FILES['userfile']['size'] > $maxfilesize) {
die("File too large");
}
// Where will the file be uploaded to?
$uploaddir = $_SERVER['DOCUMENT_ROOT'] . $phpbbdir;
// What is the files temporary name?
$file = $_FILES['userfile']['tmp_name'];
// What is the files actual name?
$filename = $_FILES['userfile']['name'];
// Does this file already exist on the server?
if(file_exists($uploaddir . $filename))
{
//die("A file with that name already exists on this server.");
echo $filename . " already exists";
die ();
}
else {
// This file does not already exist, so copy it.
copy($file, $uploaddir.$filename) or die("Could not copy file.");
}
// All done! :-)
echo $filename . " Uploaded to " .$uploaddir . " sucessfully</font>";
?>
</body>
can someone suggest why it works for me on the box, but not someone else accessing the web pages? they can see everything else fine..