file picker

This commit is contained in:
zoe 2022-09-25 18:09:47 +02:00
parent 5c4a28765c
commit 4ac218b065
1 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import 'package:http/http.dart';
class FileUpload {
final MultipartFile data;
String description;
final String path;
// media id for identity,
// gets set after first sucessfully uploading
Map<String, String> ids = {};
FileUpload({
required this.data,
required this.description,
required this.path,
this.ids = const {},
});
static Future<FileUpload> fromPath(String path, String description) async {
final data = await MultipartFile.fromPath("file", path);
return FileUpload(
data: data,
description: description,
path: path,
);
}
}