From ac2d57f02912e0cb32c0d9914e1ded18fa21ef08 Mon Sep 17 00:00:00 2001 From: yaso-meth Date: Wed, 7 Aug 2024 15:39:29 +0200 Subject: [PATCH] include subfolder to upload file api call & remove prints --- Frontend/patient_manager/lib/components/patientFiles.dart | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Frontend/patient_manager/lib/components/patientFiles.dart b/Frontend/patient_manager/lib/components/patientFiles.dart index 01379f6f..c910d5b3 100644 --- a/Frontend/patient_manager/lib/components/patientFiles.dart +++ b/Frontend/patient_manager/lib/components/patientFiles.dart @@ -143,17 +143,18 @@ class _PatientFilesState extends State { request.headers['Authorization'] = 'Bearer $token'; request.headers['Content-Type'] = 'multipart/form-data'; request.fields['app_id'] = widget.selectedPatient.app_id; + request.fields['folder'] = "patient_files"; request.files.add(await http2.MultipartFile.fromBytes('file', file.bytes!, filename: file.name.replaceAll(RegExp(r' '), '-'))); //print("here2"); var response1 = await request.send(); //print("here3"); - print(response1.statusCode); - print(response1.toString()); + //print(response1.statusCode); + //print(response1.toString()); if (response1.statusCode == 200) { //print("here3"); var fname = file.name.replaceAll(RegExp(r' '), '-'); - var filePath = "${widget.selectedPatient.app_id}/$fname"; + var filePath = "${widget.selectedPatient.app_id}/patient_files/$fname"; var response2 = await http.post( Uri.parse("${AppEnviroment.baseApiUrl}/files/insert/"), headers: {