预填充 HTML 表单文件输入 [英] Pre-Populate HTML form file input

查看:23
本文介绍了预填充 HTML 表单文件输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 VBScript,它遍历 HTML 表单,用固定值填充它,然后提交它.到目前为止它工作正常,但现在我需要设置要在表单数据中上传的文件的位置.

I have a VBScript that goes over an HTML form, fills it with fixed values and then submit it. It works fine so far, but now i need to set the location of a file that is going to be uploaded within the form data.

我相信如果我在值上设置位置它会起作用,但它不会.

I believed if I set the location on the value it was going to work, but it doesn't.

 <input type='file' name="file_field" value='file_location'/>

另外,我发现了这个在研究的同时.它说...

Also, I found this while researching. It says...

输入类型=文件Value:设置或检索控件对象的显示值.这个值在提交控制对象时返回给服务器.

有没有办法(通过代码)来填充输入,即使使用 jQuery?

Is there a way (by code) to fill that input, even with jQuery?

推荐答案

没有.这是不可能的.

出于安全原因,浏览器会阻止在输入文件类型时设置 value 属性,这样您就无法在没有用户自己选择任何文件的情况下上传文件.

Browsers block against setting the value attribute on input of file type for security reasons so that you can't upload a file without the user's selected any file himself.

这篇关于预填充 HTML 表单文件输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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