期望: 一个java web的上传图片接口,不结合jsp form表单提交
在不适用表单提交的情况下,前端使用ajax,请求后端的上传图片接口,接口将图片上传到服务器。有没有不结合jsp表单的简单的接口实现
巴扎黑2017-04-18 09:21:28
Just find an ajax upload plug-in http://www.th7.cn/web/ajax/201406/42547.shtml
PHPz2017-04-18 09:21:28
<form id="forminfo" action="http://.../saveSnapshot.xhtml" method="post" enctype="multipart/form-data" >
apiName:<input id="apiName" name="apiName" value="DiskTwistApi">
<br>
code:<input id="code" name="code" value="+r3UghilkTSfOFLfubg==">
<br>
timestamp:<input id="timestamp" name="timestamp" value="">
<br>
signature<input id="signature" name="signature" value="">
<br>
sn:<input id="sn" name="sn" style="width:500px" value="AUGUST281"/>
<br>
orderId:<input id="orderId" name="orderId" style="width:500px" value="8136"/>
<br>
img:<input id="img" name="fileInput" type="file"/>
<br>
<button type="button" onclick="check()">保存</button>
</form>