mirror of
https://github.com/HendrikRauh/inventree-app.git
synced 2026-01-13 03:26:24 +00:00
Allow file fields for api forms
This commit is contained in:
parent
e108598557
commit
8bca501fc4
5 changed files with 97 additions and 18 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue