预填充 HTML 表单文件输入

编程入门 行业动态 更新时间:2024-10-24 22:31:03
本文介绍了预填充 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 表单文件输入

本文发布于:2023-08-05 20:54:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1307999.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   文件   HTML

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!