E.target.files[0] Layer Anatomy

Source: Internet
Author: User

Because I now get a feature is the upload when the large size of the image filter, so need to get the upload to choose the size of the image, so with this blog post

Not much to say on the code

$ (' input '). Change (function (e) {

1??、 console.log (e) What did ==> get?

Get: Here are the

  1. altkey:undefined
  2. Bubbles:true
  3. Cancelable:false
  4. Ctrlkey:undefined
  5. Currenttarget:input
  6. Data:null
  7. Delegatetarget:input
  8. Detail:undefined
  9. Eventphase:2
  10. Handleobj:Object
  11. isdefaultprevented:h ()
  12. jQuery22007808826687871413:true
  13. Metakey:undefined
  14. Originalevent:Event
  15. Relatedtarget:undefined
  16. Shiftkey:undefined
  17. Target:input
  18. TimeStamp:3956.0400000000004
  19. Type:"Change"
  20. View:undefined
  21. Which:undefined
  22. __proto__:Object       

2??、 Console.log (e.target) What will you get?

The resulting input object <input type= "file" multiple= "multiple" style= "top:91px; left:44px; position:absolute; opacity:0; z index:1000; " >

3??、 Console.log (e.target.files), what do you get?

Get a bunch of filelist

    1. FileList
      1. Length:0
      2. __proto__:FileList

4??、 Console.log (E.target.files[0]) What can I get?

Get the first input to select the image of some parameters, the resulting parameters can be extracted according to their own needs, such as I now need is the size parameter, e.target.files[0].size can get the unit is B ha

  1. File
    1. LastModified:1478486422000
    2. LastModifiedDate:Mon-Nov 10:40:22 gmt+0800 (CST)
    3. Name:"222.jpg"
    4. Size:124996
    5. Type:"Image/jpeg"
    6. Webkitrelativepath: ""
    7. __proto__:File

})

Continue to refuel, step by step??

E.target.files[0] Layer Anatomy

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.