how to check if a file is selected using javascript?

后端 未结 3 1302
情深已故
情深已故 2021-01-18 05:11

In php this is how you would check if a file is selected:

$_FILES[\'item\'][\'size\']>0

what about in JavaScript?

I need to know

3条回答
  •  花落未央
    2021-01-18 05:34

    http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-49531485 says:

    value of type DOMString
    When the type attribute of the element has the value "text", "file" or "password", this represents the current contents of the corresponding form control, in an interactive user agent.

    
      ...
        
      
      
        

提交回复
热议问题