Strange error when using copy function
I am now up to chapter 10 on "Build your own website using PHP & Mysql" and have hit a brick wall, could anybody assist.
I have a simple file upload script which takes the input field type "file" and uses the $_FILES array to take the tmp name and copies it to my desired directory, but I get the following error.
The script is extremely basic:
failed to open stream: HTTP wrapper does not support writeable connections in C:\wamp\www\db-sites\ch10\fileUpload.php on line 9
Which makes me think it is a config / directory thing with Wamp?
$fileTempName = $_FILES['upload']['tmp_name'];
$fileOrigName = $_FILES['upload']['name'];
$fileSize = $_FILES['upload']['size'];
$fileType = $_FILES['upload']['type'];
$targetFileName = "http://localhost/db-sites/ch10/" . $fileOrigName;
if (!copy($fileTempName, $targetFileName))
echo "failed to copy file.";
<title>file has been uploaded</title>
<h1>file has been uploaded</h1>
<li><?php echo $fileTempName; ?></li>
<li><?php echo $fileOrigName; ?></li>
<li><?php echo $fileSize; ?></li>
<li><?php echo $fileType; ?></li>
<li><?php echo $targetFileName; ?></li>
If it is any help, no matter what file I upload I can never get windows to find the $fileTempName.
Perhaps someone has had experience with WAMP before?