我有一个 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 表单文件输入
发布评论