Allow file fields for api forms

This commit is contained in:
Oliver 2021-08-16 20:22:05 +10:00
parent e108598557
commit 8bca501fc4
5 changed files with 97 additions and 18 deletions

View file

@ -356,19 +356,14 @@ class InvenTreePart extends InvenTreeModel {
Future<bool> uploadImage(File image) async {
// Upload file against this part
final http.StreamedResponse response = await InvenTreeAPI().uploadFile(
final APIResponse response = await InvenTreeAPI().uploadFile(
url,
image,
method: 'PATCH',
name: 'image',
);
if (response.statusCode != 200) {
print("uploadImage returned ${response.statusCode} at '${url}'");
return false;
}
return true;
return response.successful();
}
// Return the "starred" status of this part