admin管理员组

文章数量:1429562

How I can get file in IE(8) like this:

<input id="files" type="file">

<script>
    var file = this.files[0]; //(FF, Chrome)
</script>

for uploading?

How I can get file in IE(8) like this:

<input id="files" type="file">

<script>
    var file = this.files[0]; //(FF, Chrome)
</script>

for uploading?

Share Improve this question edited Mar 9, 2013 at 3:33 Daniil Ryzhkov 7,6064 gold badges44 silver badges59 bronze badges asked Jun 10, 2011 at 12:55 johnnyjohnny 1,2511 gold badge16 silver badges32 bronze badges 1
  • What would this mean? "Get file" is a little vague, and I'm not sure what [0] could mean here. – Lightness Races in Orbit Commented Jun 12, 2011 at 18:14
Add a ment  | 

2 Answers 2

Reset to default 6

You can't.
IE8 doesn't support this feature.

Native file input boxes do not have the files attribute in IE8. However when the user selects a file its URL bees the value of the input element, so there is no problem to retrieve it.

本文标签: javascriptHow can I get file from input in IE8Stack Overflow