I am writing a simple file upload script and seem unable to receive the uploaded file. My script is simple:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>File Upload Form</title>
</head>
<body>
This form allows you to upload a file to the server.<br>
<form action="<?=$me?>" method="post"><br>
Type (or select) Filename: <input type="file" name="userfile"><input type="submit" value="Upload File">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
echo "GET method";
}
else {
print_r($_SERVER);
echo '<br />';
print_r($_FILES);
}
?>
</body>
</html>
My hosting service says there's an error with my script - I don't see it. This is the first time I've tried file upload on their systems.... Where's my error?
thanks in advance
$_FILES is empty
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
Re: $_FILES is empty
Add: to your form tag.
Ps. Do we still have HTML/CSS/SQL/etc. code tags? How do I use them?
Code: Select all
enctype="multipart/form-data"Ps. Do we still have HTML/CSS/SQL/etc. code tags? How do I use them?
Re: $_FILES is empty
[ code=php ] [ /code ]jayshields wrote:Add:to your form tag.Code: Select all
enctype="multipart/form-data"
Ps. Do we still have HTML/CSS/SQL/etc. code tags? How do I use them?
[ code=html ] [ /code ]
[ code=sql ] [ /code ]
etc..
Re: $_FILES is empty
Awesome! thanks!
-P
-P