本文介绍了自动提交表单选择上传文件时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML页面下输入标签:

I have a HTML page with the following input tag:

...
<input type="file" id="browseContactImageButton" />
...

点击页面结果打开文件对话框按钮。如果我想要做实际的上传,我需要另一个按钮,点击(提交),因为使用该输入文件按钮,只需提供文件路径。

Clicking the button on the page results in Open File Dialog. If I want to do the actual uploading, I need another button to click (submit), because this input file button is used just to provide the path to the file.

是否可以单击浏览按钮,选择文件并启动该文件已被选定后,立即上传功能?如果是的话,任何人都可以提供code段?谢谢。

Is it possible to click the browse button, select the file and to start the uploading function immediately after the file has been chosen? If yes, could anyone provide the code snippet? Thanks.

推荐答案

如果你想要的形式后,用户提交作出他们的选择,然后只需添加

If you want the form to submit after the user has made their selection, then simply add

<input type="file" onchange="this.form.submit();" ..... >

这篇关于自动提交表单选择上传文件时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 07:42