用一个按钮上传文件 [英] Upload File with one button

查看:121
本文介绍了用一个按钮上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在html中创建一个按钮,以发送允许您选择文件的文件,然后将它发送到我想要的页面上,而无需使用按钮选择文件,然后使用按钮将文件发送给另一个页?
谢谢!

How can I make a button in the html you need to send files that allow you to select the file and then sending it on the page that I want without using a button to select the file and a button to send it to another page? Thanks you!

推荐答案

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




  • jsFiddle Demo

  • MDN上的form.submit()

    • jsFiddle Demo
    • form.submit() on MDN
    • 这篇关于用一个按钮上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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