HTML - Upload Forms
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 Browse button 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.
HTML Upload Field Code:
<form name="myWebForm" action="mailto:youremail@email.com" method="post">
<input type="file" name="uploadField" />
</form>
HTML Upload Field:
HTML - Max File Size Field
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.
HTML MAX_FILE_SIZE Code:
<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>
HTML MAX_FILE_SIZE:
The value attribute specifies the maximum allowable kilobytes (KB) for any file selected by the user.
Found Something Wrong in this Lesson?Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time! |