为输入类型设置文件路径=“file” [英] Set file path for input type="file"

查看:154
本文介绍了为输入类型设置文件路径=“file”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input name =pictureULtype =filevalue我们可以在JavaScript中设置文件路径=uploadonChange =this.form.submit()/> 

无需打开选择文件对话框?
我有两个按钮SCAN和FIND。 ADD按钮打开对话框,要求用户选择要上传到服务器的文件。 SCAN按钮必须扫描文档并将其上传到服务器。扫描是好的,但提交我需要在文件标记中设置文件路径的表单,因为我在那里提交表单。有没有办法做到这一点?
在此先感谢。

解决方案

由于可能存在安全问题,现代浏览器不允许您访问文件路径或修改< input type =file> 的值。您还无法查看文件路径,因为它将显示 C:\ fakepath \ yourfilename.yourfilextension


Can we set the file path in javascript for

<input name="pictureUL" type="file" value="upload" onChange="this.form.submit()"/>

without opening the select file dialog box? I have 2 buttons SCAN and FIND. ADD button opens dialog box asking user to select the file which will be uploaded to the server. SCAN button has to scan the document and upload it to the server. Scanning is fine but to submit the form i need to set the file path in the file tag as i am submitting the form there. Is there a way to do it? Thanks in advance.

解决方案

Due to possibly security issues, modern browsers do not allow you to access the file path or modify the value of an <input type="file">. You also cannot view the file path, as it will display C:\fakepath\yourfilename.yourfilextension.

这篇关于为输入类型设置文件路径=“file”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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