通过type = file获取文件路径 [英] Get file path through type=file

查看:137
本文介绍了通过type = file获取文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个html元素输入类型文件。我使用此代码获取多个文件名:

I have an html element input type file. I am getting the multiple file names using this code:

<input id="inputAddVideo" onchange="AddVideo(this.id)" type="file" name="upload" multiple/>

 var files = $('input[type="file"]')[0].files;
    for (var i = 0; i < files.length; i++) {
        alert('path: ' + files[i].path);
        var filename = files[i].name.split('.');
}

现在与此同时,如何使用javascript检索每个文件的路径?

Now at the same time, how can I retrieve path of each file using javascript?

推荐答案

您将无法通过JavaScript访问此内容;作为一项安全防范措施,浏览器将向您公开文件名,但没有涉及本地文件系统。

You won't be able to access this via JavaScript; as a security precaution the browser will expose the file name to you, but nothing else about the local file system.

这篇关于通过type = file获取文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆