从< input type =" file" />获取路径 [英] get path from <input type="file"/>
问题描述
< input type =fileid =uploadFontvalue =上传字体/ >
将字体上传到我的应用程序。打开文件对话框打开并选择字体。
如何获得所选字体的路径
这是依赖于浏览器的,但在现代安全的浏览器上却不行 - 这是一件好事。如果您能够读取此路径,则攻击者也将能够(这是一个巨大的信息泄漏),例如,如果您从中选择了一个文件,则主要给他提供用户名。 我的文档或您的主目录。
如果您描述,您需要这个路径,我们可以帮助您设想一个解决方法,但是从POV你的浏览器,这只是一些文件,没有它的位置在底层的操作系统文件树的概念。
I am using
<input type="file" id="uploadFont" value="Upload Font"/>
to upload a font to my application. The open file dialog opens up and I choose the font.
How can I get the path of the choosen font.
This is browser-dependant, but on modern secure browsers you can't - and this is a good thing. If you were able to read this path, an attacker would also be able to, which is a huge information leak - for example it mostly gives him your username, if you chose a file from e.g. "My Documents" or your home directory.
If you describe, what you need this path for, we might be able to help you conceive a workaround, but from the POV of your browser, this is just "some file", without the notion of its location in the underlying OS file tree.
这篇关于从< input type =" file" />获取路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!