Question

In HTML / PHP, how to load a user file from client to server?


Annonce
Ad

Answer

index.html
<html><body>
    <form enctype="multipart/form-data" action="process.php" method="post">
        <input type="hidden" name="MAX_FILE_SIZE" value="2000000" >
        <input name="file" type="file" >
        <button type="submit">Send</button>
    </form>
</body></html>
process.php
<?php
echo '<pre>';
// Display file info
var_dump($_FILES['file']);
// Display file content
echo "\nFile content: \n".file_get_contents($_FILES['file']['tmp_name']);
echo '</pre>';
?>


[source]
# ID Query