Upload fields provide the interface that allows users to select a local file and upload it to the web server. An upload field renders as two parts -- an empty text field and a Browsebutton that opens up a local window explorer on the user's computer. This allows them to quickly browse to the local file and automatically fills in the file path inside of the text field.
Setting the type attribute of the <input> to "file" places the upload element on a web page.
<form name="myWebForm" action="mailto:youremail@email.com" method="post"> <input type="file" name="uploadField" /> </form>
File transferring across the internet is a complicated process and should include many layers of security. HTML alone cannot ensure safe and secure file transferring, but it can offer a first line of defense. Using a MAX_FILE_SIZE hidden field can limit the size of files that are transferred.
Placing a restraint on an HTML upload field is accomplished by using a hidden input field with the name attribute set to MAX_FILE_SIZE.
<form name="myWebForm" action="mailto:youremail@email.com" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="500" /> <input type="file" name="uploadField" /> </form>
The value attribute specifies the maximum allowable kilobytes (KB) for any file selected by the user.