28 lines
603 B
Dart
28 lines
603 B
Dart
|
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,
|
||
|
);
|
||
|
}
|
||
|
}
|