如何为 HTML 中的文件输入设置值? [英] How to set a value to a file input in HTML?

查看:29
本文介绍了如何为 HTML 中的文件输入设置值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置这个值?

<input type="file" />

推荐答案

由于安全原因,您不能.

You cannot, due to security reasons.

想象一下:

<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屋!

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