I'm relatively new new to php, I'm using a book calles "SAMS Teach Yourself PHP, MySQL, and Apache in 24 Hours". It has many scripts for you to use to learn the 3. In doing a file upload script from the book and I keep getting the following error
Here are the scripts.Code:Parse error: parse error, unexpected T_STRING in D:\Web Sites\practicesite\9.14.php on line 13
And.Code:<html> <head> <title>Listing 9.13 A Simple File Upload Form</title> </head> <body> <form action="9.14.php" enctype="multipart/form-data" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="51200"> File to Upload: <input type="file" name="fileupload"><br><br> <input type="submit" value="UPLOAD!"> </form> </body> </html>
Can someone please help me correct this error.Code:<html> <head> <title>Listing 9.14 A File Upload Script</title> </head> <body> <h1> File Upload Results </h1> <?php $file_dir = "\uploadedfiles\"; foreach($_FILES as $file_name => $file_array) { print "path: "$file_array['tmp_name']"<br>\n"; print "name: "$file_array['name']"<br>\n"; print "type: "$file_array['type']"<br>\n"; print "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"); print "file was moved!<br><br>"; } } ?> </body> </html>
Thanks,
Taylor





Bookmarks