I been learning from a teach yourself book and have come up against a brickwall that is making me crazy. Thank you in advance to anyone that can help me!
The error message I am getting is;
Parse error: syntax error, unexpected T_STRING, expecting ']' in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Sams\do_upload.php on line 5
The html for the upload page is;
<html>
<head>
<title>A simple file upload form</title>
</head>
<body>
<form action="do_upload.php" enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200" />
<p><strong>File to Upload:</strong>
<input type="file" name="fileupload" /></p>
<p><input type="submit" value="upload!" /></p>
</form>
</body>
</html>
And finally the php code I have copied from the book is
<?php
$file_dir = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\test\";
foreach($FILES as $file_name => $file_array) {
echo "path: ".$file_array['"tmp'name"]."<br />\n";
echo "name: ".$file_array[''"name"]."<br />\n";
echo "type: ".$file_array["'type'"]."<br />\n";
echo "size: ".$file_array[''"size"]."<br />\n";
if (is_uploaded_file($file_array['"tmp_'name"]))
{ move_uploaded_file($file_array['"tmp_'name"],"$file_dir".$file_array["name"]") or die ("Couldn't copy");
echo "file was moved!<br />";
}
}
?>
I am a little confused about all the ' and " usage but this exactly as it appears in the book so I'm wondering is it a publishers error or am I missing something?
Your help will be hugely well received.