JS gets the file size, file name, last modified time, type, and so on input type= "file" selected

Source: Internet
Author: User

  1. <HTML xmlns="http://www.w3.org/1999/xhtml" >
  2. <head runat="Server" >
  3. <meta http-equiv= "content-type" content= "text/html; Charset=utf-8 "/>
  4. <title></title>
  5. </head>
  6. <body>
  7. <form id="Form1" runat="Server" >
  8. <div>
  9. <input type="file" name="F" id="F"/>
  10. <input type="button" name="AA" id="AA" value="test" onclick= "javascript: _s ();"/>
  11. </div>
  12. </form>
  13. </body>
  14. </html>
  15. <script type="Text/javascript" >
  16. function _s () {
  17. var f = document.getElementById ("F"). Files;
  18. //Last modification time
  19. Alert (f[0].lastmodifieddate);
  20. //Name
  21. Alert (f[0].name);
  22. //Size byte
  23. Alert (f[0].size);
  24. //Type
  25. Alert (f[0].type);
  26. }
  27. </script>

JS gets the file size, file name, last modified time, type, and so on input type= "file" selected

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.