一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

Android使用Retrofit仿微信多张图片拍照上传

时间:2017-01-17 编辑:简简单单 来源:一聚教程网

Android 仿照微信发说说,既能实现拍照,选图库,多图案上传,使用Retrofit技术。

项目的运行效果:

服务器端接收文件的action

UploadFile.java

 

 代码如下复制代码

@Controller

publicclassUploadFileextendsActionSupport {

 

 /**

 *

 */

 privatestaticfinallongserialVersionUID = 1L;

 privateFile[] file;//文件数组

 privateString description;//说说内容

 publicFile[] getFile() {

 returnfile;

 }

 publicvoidsetFile(File[] file) {

 this.file = file;

 }

 publicString getDescription() {

 returndescription;

 }

 publicvoidsetDescription(String description) {

 this.description = description;

 }

 @Action("/upload")

 publicvoidupload() {

 System.out.println("上传的文件="+Arrays.toString(file));

 System.out.println("说说内容="+description);

 }

}

 

服务器运行效果:

代码:https://github.com/lidong1665/Android-UploadMultipartImage

热门栏目