从画廊上传多个图像

Posted

技术标签:

【中文标题】从画廊上传多个图像【英文标题】:Flutter Multiple Images upload from gallery 【发布时间】:2021-12-10 19:46:24 【问题描述】:

如何使用多部分请求从图库中上传多张图片 在颤抖? 我想通过API上传多个图片文件到服务器

【问题讨论】:

pub.dev/documentation/http/latest/http/… 【参考方案1】:

您可以使用flutter_uploader 上传多个文件:

final taskId = await uploader.enqueue(
  url: "your upload link", //required: url to upload to
  files: [FileItem(filename: filename, savedDir: savedDir, fieldname:"file")], // required: list of files that you want to upload
  method: UploadMethod.POST, // HTTP method  (POST or PUT or PATCH)
  headers: "apikey": "api_123456", "userkey": "userkey_123456",
  data: "name": "john", // any data you want to send in upload request
  showNotification: false, // send local notification (android only) for upload status
  tag: "upload 1"); // unique tag for upload task
);

【讨论】:

以上是关于从画廊上传多个图像的主要内容,如果未能解决你的问题,请参考以下文章