如何设置一个值到HTML文件输入? [英] How to set a value to a file input in HTML?
本文介绍了如何设置一个值到HTML文件输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
< input type =file/>
如何设置这个值?
试想:
$ b pre> < form name =foomethod =postenctype =multipart / form-data>
< input type =filevalue =c:/passwords.txt>
< / form>
< script> document.foo.submit();< / script>
您不希望您访问的网站能够这样做吗? =)
<input type="file" />
How can I set the value of this?
解决方案
You cannot due to security reasons.
Imagine:
<form name="foo" method="post" enctype="multipart/form-data">
<input type="file" value="c:/passwords.txt">
</form>
<script>document.foo.submit();</script>
You don't want the websites you visit to be able to do this, do you? =)
这篇关于如何设置一个值到HTML文件输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文