[英]Open “Select file” dialog and send form using javascript
我有一個簡單的表格
<form enctype="multipart/form-data" action="/clients" method="post">
<input id="file" type="file" />
</form>
我需要調用文件上傳對話框,如果成功,請發送表格(使用javascipt)
<form enctype="multipart/form-data" action="/clients" method="post" id="fileForm">
<input id="file" type="file" />
</form>
<script>
document.getElementById('file').onchange=function () {
document.getElementById('fileForm').submit();
}
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.