Electron:获取上传文件的完整路径 [英] Electron: get full path of uploaded file

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

问题描述

我现在使用 Electron 构建 GUI.(例如桌面应用的 PhoneGap)

I'm buildind now GUI using Electron. (like PhoneGap for desktop apps)

有没有办法为 <input type="file"> 中检查的文件启用完整路径?
现在安装 C:fakepathdataset.zip.(目录名不是fakepath",而是 document.getElementById("myFile").value 的值)

Is there a way to enable full path for file checked in <input type="file">?
Insted of C:fakepathdataset.zip now. (the directory name isn't "fakepath", but that is the value of document.getElementById("myFile").value)

或者,还有其他选择文件的方法吗?

Or, is there other way to select a file?

推荐答案

Electron 添加了一个path 属性到 File 对象,因此您可以使用以下方法从输入元素获取真实路径:

Electron adds a path property to File objects, so you can get the real path from the input element using:

document.getElementById("myFile").files[0].path

这篇关于Electron:获取上传文件的完整路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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