Jump to content


This topic is now archived and is closed to further replies.


File Upload PHP Script

Recommended Posts

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">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Upload Form</title>
<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>

Than I created the do_upload.php as refered to in the above script. (below)

$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'])) {
"$file_dir/$file_array[name]") or dir ("Couldn't copy");
echo "file was moved!<br /><br />;

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?



Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.