Skip to content

Instantly share code, notes, and snippets.

@carzacc
Created February 2, 2020 13:51
Show Gist options
  • Save carzacc/4037d367611b995d505927c7fd16835b to your computer and use it in GitHub Desktop.
Save carzacc/4037d367611b995d505927c7fd16835b to your computer and use it in GitHub Desktop.
(String filename, String url) async {
var request = http.MultipartRequest('POST', Uri.parse(url));
request.files.add(
http.MultipartFile(
'picture',
File(filename).readAsBytes().asStream(),
File(filename).lengthSync(),
filename: filename.split("/").last
)
);
var res = await request.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment