WampServer
Apache, PHP, MySQL on Windows
Home forum
Back to WampServer
presentation
Downloads
Addons
Trainings
Alter Way
Go to Topic:
Previous
•
Next
Go to:
Forum List
•
Message List
•
New Topic
•
Search
•
Log In
•
Print View
Upload File Error: Undefined Index?
Posted by:
steele
(---.lsanca.dsl-w.verizon.net)
Date: January 03, 2011 08:06AM
Experience: Beginner
Hi All!
Uploading files are supposed to be a cinch - but I can't seem to get it to work. Any help would be appreciated. Here is my code and results:
<?php
echo <<<_END
<form method='post' action='upload.php' enctype='multipart/form-data'>
<input type='file' name='filename' size='20' />
</form>
_END;
$array['file_uploads'] = ini_get('file_uploads');
$array['directory'] = ini_get ('upload_tmp_dir');
$array['maxsize'] = ini_get('upload_max_filesize');
print_r ($_FILES['filename']['name']);
echo "<pre>";
foreach ($array as $key=>$val){
echo "$key: $val \t";
}
if (!is_dir($array['directory']) && !empty($array['directory'])){
echo "upload directory is incorrectly specified";
}
if (!is_writable($array['directory']) && !empty($array['directory'])){
echo "upload directory is not writable";
}
if ($_FILES)
{
$name = $_FILES['filename']['name'];
move_uploaded_file($_FILES['filename']['tmp _name'], $name);
echo "Uploaded image '$name'<br /><img src='$name' />";
}
?>
--RESULTS--
Notice: Undefined index: filename in F:\wamp\www\upload.php on line 13
file_uploads: 1 directory: F:/wamp/tmp maxsize: 2M
Options:
Reply
•
Quote
Re: Upload File Error: Undefined Index?
Posted by:
steele
(---.lsanca.dsl-w.verizon.net)
Date: January 03, 2011 10:20PM
Would this happen to have anything to do with the directory set, for 'upload_tmp_dir' in 'php.ini', having forward slashes (/) versus backslashes (\) ?
Thanks!
Options:
Reply
•
Quote
Go to:
Forum List
•
Message List
•
Search
•
Log In
Sorry, only registered users may post in this forum.
Click here to login