-1
如何編寫自動提交表單(用於文件上傳)?我試着在<input>
字段添加onchange
:輸入文件和自動提交 - 播放框架2
@form(action = routes.Application.upload, 'enctype -> "multipart/form-data") {
<div class="fileupload fileupload-new" data-provides="fileupload">
<span class="btn btn-large btn-primary btn-file">
<span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file" name="file" onchange="@routes.Application.upload()"/>
</span>
<span class="fileupload-preview"></span>
<a href="#" class="close fileupload-exists" data-dismiss="fileupload" style="float: none">×</a>
<input class="btn btn-success btn-large" type="submit" value="Submit!">
</div>
}
,但它不工作。有任何想法嗎?我正在使用Play Framework 2與Java