0

我正在尝试编写一个程序,或者实际上是 HTML 页面,它有 3 个输入,名字、姓氏和日期,以及一个确定按钮。它应该在特定文件夹(即 C:\Test\John_Smith_22AUG13.pdf)内查找具有这三个输入作为文件名(即:John_Smith_22AUG13.pdf)的文件,如果存在,则将路径复制到剪贴板,以便然后用户可以将其粘贴到电子邮件中。我想知道是否有人在过去做过类似的事情,并且有任何建议或编程语言我应该用来做这件事。这可以使用javascript完成吗?如果不是我还能用什么?

什么都有帮助!谢谢!

4

3 回答 3

1

您可以查看http://www.w3.org/TR/FileAPI/#dfn-filelist并尝试

<input type="file">

一种方式并在 JS 方法中处理所选文件。正如brandon-gardiner 已经说过的,由于安全限制,对本地文件系统的访问实际上非常有限

于 2013-08-22T21:12:08.747 回答
1

我可能弄错了,但由于这是在网页内,我相信您无法直接访问用户计算机的文件系统。这会打开许多​​安全漏洞,而且会很糟糕。所以从一个网络应用程序中,我不相信这是可能的。

于 2013-08-22T20:57:09.853 回答
0

If you meant a file stored on your local computer, you will have to create a program using languages like C, C++, or maybe even PHP if you create a local webserver. Accessing files on your computer just using a html or JavaScript is not possible. As your question is not quite clear, maybe a file input is what you are looking for, like Jeroen answered. Then you can maybe use JavaScript to determine the path of the selected file... Although, as you said you were good in JavaScript, you probably already known that.

于 2013-08-22T21:51:14.957 回答