预先填充HTML表单文件输入 [英] Pre-Populate HTML form file input
问题描述
我有一个VBScript,通过一个HTML表单,用固定值填充,然后提交。它到目前为止工作正常,但现在我需要设置一个文件的位置将被上传在表单数据。
我相信如果我设置的位置
< input type ='file'name = file_fieldvalue ='file_location'/>
另外,我发现这,而研究。它说...
$ b
输入类型=文件
值:设置或获取控制对象的显示值。当提交控件对象时,这个值返回给服务器。
有没有一种方法(通过代码)来填充输入,即使使用jQuery?
没有。这是不可能的。
由于安全原因,浏览器阻止设置输入文件类型的值属性,因此,如果用户没有选择任何文件本身。
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...
input type=file Value: Sets or retrieves the displayed value for the control object. This value is returned to the server when the control object is submitted.
Is there a way (by code) to fill that input, even with jQuery?
No. This is not possible.
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 itself.
这篇关于预先填充HTML表单文件输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!