本篇文章为大家展示了如何android在中使用springMvc实现图片上传功能,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。
具体内容如下
Android端:
String fileName = tvFilename.getText().toString(); RequestBody description = RequestBody.create( okhttp3.MultipartBody.FORM, fileName); File fileImage = new File(saveFileName); RequestBody requestBody1 = RequestBody.create(MediaType.parse("multipart/form-data"), fileImage); MultipartBody.Part body = MultipartBody.Part.createFormData("bannerImage", fileImage.getName(), requestBody1); RestClient.api().addLive(description, body) .enqueue(new retrofit2.Callback<ResponseInfo>() { @Override public void onResponse(retrofit2.Call<ResponseInfo> call, retrofit2.Response<ResponseInfo> response) { "处理成功" } @Override public void onFailure(retrofit2.Call<ResponseInfo> call, Throwable t) { "处理失败" } });
网站栏目:如何android在中使用springMvc实现图片上传功能-创新互联
网站路径:https://www.cdcxhl.com/article24/joice.html
成都网站建设公司_创新互联,为您提供建站公司、外贸建站、企业建站、手机网站建设、网站营销、营销型网站建设
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联