I cannot believe that I should ask about this, but for some reason my file does not work. It is called ajax.php (although not against the name), and here is the exact code:
<?php
error_reporting(-1);
print_r($_POST);
print_r($_FILES);
?>
<form action="ajax.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="text" name="first" value="Bob" />
<input type="text" name="middle" value="James" />
<input type="text" name="last" value="Smith" />
<input type="file" name="something" />
<input type="submit" value="Submit" />
</form>
When I send without attaching a file, it prints the data in arrays. When I send WITH with a file, no arrays are populated.
What obvious thing am I missing ???
No file
Array ( [MAX_FILE_SIZE] => 30000 [first] => Bob [middle] => James [last] => Smith )
Array ( [something] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) )
With file
Array ( )
Array ( )
EXPECTED WITH A FILE
Array ( [MAX_FILE_SIZE] => 30000 [first] => Bob [middle] => James [last] => Smith )
Array ( [something] => Array ( [name] => sample.jpg [type] => image/jpg [tmp_name] => whatever.jpg [error] => 0 [size] => 1248 ) )
UPDATE
It seems that it is working on another server, DEFINING some configuration with my WAMP, that is, my question was asked incorrectly, and therefore I close it. I apologize to those who spent time on my stupidity.
source
share