javascript - type=file
阿神
阿神 2017-05-19 10:36:13
0
2
700
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <input type="file" id="shangChuan"  multiple="multiple" accept="image/*" />
    </body>
    <script type="text/javascript">
        var shangChuan = document.getElementById("shangChuan");
        shangChuan.addEventListener("change",function () {
            alert(shangChuan.value)
        })
    </script>
</html>

The picture address of Huawei Honor 7i is wrong..

My picture name da_1488896847485.jpeg

阿神
阿神

闭关修行中......

reply all(2)
左手右手慢动作

What’s wrong?

小葫芦

In this way, the relevant information of the selected file cannot be obtained.
To obtain basic information, you can use the files attribute of input. The attribute value is the FileList object. The information includes the last modification time of the file, file name, file size, and file type.
To get the address of the image, we can operate it through the FileReader object.
For the complete content of front-end access to files, you can read MDN's "Using Files in Web Applications", or you can read the simplified version of my summary

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template