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

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

问题描述

我现在正在使用Electron建立GUI。 (例如用于桌面应用程序的PhoneGap)

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

是否可以为< input type = file>中的已检查文件启用完整路径

现在已安装 C:\fakepath\dataset.zip 。 (目录名称不是 fakepath,但这是 document.getElementById( myFile)。value 的值)

Is there a way to enable full path for file checked in <input type="file">?
Insted of C:\fakepath\dataset.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?

推荐答案

电子添加了 路径 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

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

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