input file

input file
HTML input file Element
Setting the HTML input element's type attribute to "file" will render a file upload field in a web <form>. This allows a user to browse their computer for a file to upload. The user places their selected file in the file field and continues filling out your form and all data can be parsed at once when they press submit.

HTML CODE EXAMPLE
<form enctype="multipart/form-data" action="parse_file.php" method="post">
  <p>Browse for a file to upload: </p>
  <input type="file" name="uploaded_file">
  <br /><br />
  <input type="submit" value="Upload It Now">
</form>

 
Browse for a file to upload:


File Upload Tip: In order to move files to the server the <form> enctype attribute must be set to "multipart/form-data". The image will not upload if you do not set the <form> tag's enctype correctly for handling file upload. Forms by default handle data using the "application/x-www-form-urlencoded" data encoding type.

Attributes for this element:

type - specify the type of input
Value: "file"

name - specify the file's name that your form parsing script will access
Possible Values: "short descriptive name"

accept - suggest the file types that will be accepted
Possible Values: "comma separated list of valid MIME types"

disabled - specify that the input be disabled
Possible Values: "disabled"

global attributes - global core attributesSee: list of global attributes

New HTML5 attributes for this element:(applies 2014)

form - set a relationship between the input and a form
Possible Values: "a form's id attribute value"

autofocus - specify that the input receive focus when page is loaded
Possible Values: "autofocus"

multiple - specify that multiple files can be selected for upload
Possible Values: "multiple"

required - specify that the input is a required form field
Possible Values: "required"

Event handlers for this element:

global event handlers - global event handler attributesSee: list of global event handlers

0 Response to "input file"

Post a Comment