java上传图片

期望: 一个java web的上传图片接口,不结合jsp form表单提交
在不适用表单提交的情况下,前端使用ajax,请求后端的上传图片接口,接口将图片上传到服务器。有没有不结合jsp表单的简单的接口实现

波斯汪
浏览 502回答 3
3回答

海绵宝宝撒

<form id="forminfo" action="http://.../saveSnapshot.xhtml" method="post" enctype="multipart/form-data" >&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;apiName:<input id="apiName" name="apiName" value="DiskTwistApi">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;code:<input id="code" name="code" value="+r3UghilkTSfOFLfubg==">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;timestamp:<input id="timestamp" name="timestamp" value="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;signature<input id="signature" name="signature" value="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sn:<input id="sn" name="sn" style="width:500px" value="AUGUST281"/>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;orderId:<input id="orderId" name="orderId" style="width:500px" value="8136"/>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;img:<input id="img" name="fileInput" type="file"/>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<button type="button" onclick="check()">保存</button>&nbsp; &nbsp; </form>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java