Yes, the enctype
attribute is set. Other forms/form-hanlders work fine so the temp directory must be writable. I'm out of Ideas.
I checked the post values and $_POST['file']
exists and contains the name of the file.
Here is my form and the PHP that handles it. What am I missing?
<form action='orl_ftp.php' method='post' enctype='multipart/form-data'>
<table>
<tr>
<td>Choose File: </td>
<td><INPUT type='file' id='file' name='file'></td>
</tr>
<tr>
<td> </td>
<td><INPUT type='submit' name='Submit' value='Process'></td>
</tr>
</table>
</form>
And the relevant PHP code. Note that the $_FILES array is set, it's just empty.
if(isset($_POST['Submit'])){
$upload_results = "";
if(!isset($_FILES)){$upload_results .= "No files uploaded"; }
if($upload_results == ""){
echo "<pre>";
var_dump($_FILES);
exit;
// ...
}
}
You have multiple forms in the same script and so each of them needs the enctype='multipart/form-data'
Also, it doesn't look like you close the first form and doing <form ... />
is not valid html.
On line 101:
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>" />
^
This is causing the issue, the browser it keeping this form open and therefore the missing enctype
is the issue. Remove or close this form properly.
Example:
<?php
if(isset($_POST['Submit'])){
$upload_results = "";
if(!isset($_FILES)){$upload_results .= "No files uploaded"; }
if($upload_results == ""){
echo "<pre>";
var_dump($_FILES);
exit;
}
}
?>
<form action='' method="post" />
<form action='' method='post' enctype='multipart/form-data'>
<table>
<tr>
<td>Choose File: </td>
<td><INPUT type='file' id='file' name='file'></td>
</tr>
<tr>
<td> </td>
<td><INPUT type='submit' name='Submit' value='Process'></td>
</tr>
</table>
</form>
This will not post any files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With