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

HTMLJavascriptProgramming Scripts

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/*">
raja
Published on 21-Mar-2018 07:29:42
Advertisements