HTML - Upload form

The upload form is a very practical form to allow the users to send photos, documents or any other kind of files to the server.

To create an upload form we will only have to establish the file value to the <input type=""> tag.

html<input type="file" />

Demo

Upload - MAX_FILE_SIZE

To limit the size of some of the files uploaded on the webhosting server we will use a hidden field. MAX_FILE_SIZE does not eliminate checking the file on server-side.

html<input type="hidden" name="MAX_FILE_SIZE" value="4194304" />

<input type="file" />

Demo

The value chosen in the example above was 4194304. That means that files over 4194304 bytes (4MB) will not be allowed for upload.