I have removed all unrelated code from the script below in an attempt to narrow down the problem but even I’m now down to ‘bare-bones’ it still won’t work.
There is no error in the web server error log concerning this and print_r($_Files) is empty. What could possibly be stopping this from working please?
The file I’m attempting to upload is 20Kb.
The php server variable upload_max_filesize = 100M and post_max_size = 101M.
<?
echo 'Here is some debugging info:';
print_r($_FILES);
if ($_FILES['image']['name']) {
echo "\n\nFiles Detected";
} else {
?>
<!DOCTYPE HTML>
<html>
<head>
<title>File Upload</title>
</head>
<body>
<form
action = "<?=$_SERVER['PHP_SELF']?>"
enctype = "multipart/form-data"
name = "uploadImage">
Upload:
<input type='file' name='image'><br><br>
<input type="submit" value="Upload">
</form>
</body>
</html>
<? } ?>
Files are not detected.
For uploading files you need to use “post”. Since you are not specifing “method” attribute for form tag default method is “get” Try setting
method="post"for your form.