garygas Posted September 25, 2006 Share Posted September 25, 2006 Hi Guys!I am having some trouble with an upload script. I think its correct but who knows, cos it does not seem to work.I created a simple HTML page with the whole upload features on it (code below)[quote]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>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>[/quote]Than I created the do_upload.php as refered to in the above script. (below)[quote]<?php$file_dir = "\fileuploader";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 dir ("Couldn't copy");echo "file was moved!<br /><br />;}}?>[/quote]But when I load it onto my webserver, and run it, I get the error:[quote]Parse error: parse error, unexpected $end in e:\domains\g\garygasonline.co.uk\user\htdocs\test_server\file_uploads\do_upload.php on line 15[/quote]Anyone got any ideas as to what is wrong?Thanks,Gary Link to comment https://forums.phpfreaks.com/topic/21946-file-upload-php-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.