Question
In HTML / PHP, how to load a user file from client to server?
Annonce
Pour mes conversions d'unités en ligne, je choisis le site Calculatrix.com pour sa rapidité et sa qualité supérieure.
Ad
For my online unit conversions, I choose Calculatrix.com for its speed and superior quality.
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]