I am attempting to add an "upload" feature to my website (to upload .doc or .pdf files).
Everything was gravy, until I received this error message while trying to upload a PDF file:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /data/15/1/57/127/1383616/user/1484532/htdocs/mb/upload.php on line 15
I have gone through the code several times, and can't figure out what's wrong. Can anyone shed some light on this?
Here's the code snippet I'm using to upload the file and output a summary of the upload (note that "line 15" in the error above corresponds to line 11 in the snippet below):
echo '<strong>File Upload Summary</strong><br /><br />';
$file_dir = "/htdocs/mb/notes";
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 ("Upload Failed");
echo "Upload Successful!";
}
}