HTML Old School
Input file
When we want to upload a file to the server we will use:
<form action="" method="POST" enctype="multipart/form-data">
Image: <input type="file" name="pic">
</form>
Don't forget to write multipart/form-data .
To upload multiple files use multiple .
<form action="" method="POST" enctype="multipart/form-data">
Image: <input type="file" name="pics[]" multiple>
</form>
Form for uploading multiple images: 08file_multiple.html
PHP script is using $_FILE array: 08file_script.php
File field attributes
1. name="string"
Define variable name.
2. accept="filetype/*"
Define file mime type that will be accepted.
<input type="file" accept="application/msword">
Can be: text/html , image/gif , image/jpg ...etc.
Multiple mime types separate with comma.