Set the types of files that the server accepts in HTML

HTMLFront End TechnologyWeb Development

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 accept attribute −

<!DOCTYPE html>
<html>
   <head>
      <title>File Upload Box</title>
   </head>
   <body>
      <form>
         <input type = "file" name = "fileupload" accept = "image/*" />
      </form>
   </body>
</html>
raja
Published on 13-Mar-2018 15:57:10
Advertisements