Android使用Retrofit技术仿微信图片上传,可以选择多张图片拍照上传

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

使用方法:详见博客

http://blog.csdn.net/u010046908/article/details/50767904

项目的运行效果:

这里写图片描述

这里写图片描述

服务器端接收文件的action

UploadFile.java

@Controller
public class UploadFile extends  ActionSupport {

     /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private File[] file;//文件数组
    private String description;//说说内容
    public File[] getFile() {
        return file;
    }
    public void setFile(File[] file) {
        this.file = file;
    }


    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Action("/upload")
    public void upload()  {
        System.out.println("上传的文件="+Arrays.toString(file));
        System.out.println("说说内容="+description);
    }



}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

服务器运行效果:

这里写图片描述

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

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!http://www.captainbed.net

猜你喜欢

转载自www.cnblogs.com/skiwnchhw/p/10472326.html