HTML file input control with capture and accept attributes is not working correctly



Use the accept attribute to set the types of files that the server accepts in HTML. Use the attribute only with <input type="file">.

Example

You can try to run the following code to work with the accept attribute:

<!DOCTYPE html>
<html>
   <head>      
   <title>File Upload Box</title>    
   </head>
   <body>
      <form>    
         <input type = "file" name = "fileupload" accept = "image/*" />  
      </form>
   </body>
</html>

The capture attribute is a boolean attribute that, if specified, indicates that the capture of media directly from the device...is preferred.

The capture attribute is NOT used to include the camera option in the dialog but to indicate that direct capture from the webcam is preferred.  

The "correct" code is given below

<input type = "file" accept = "image/*">
Lakshmi Srinivas
Lakshmi Srinivas

Programmer / Analyst / Technician


Advertisements