From 2e89114d29fe57c87a3d046a6ee8f36e5ee14766 Mon Sep 17 00:00:00 2001 From: "CHIEFSOFT\\ameye" Date: Sun, 5 Nov 2023 15:30:45 -0500 Subject: [PATCH] file not there --- wrenchboard/src/shared_tool/media.cc | 14 ++++---------- www-api/app/Controllers/WrenchMedia.php | 9 ++++++++- www-api/app/Models/UploadManager.php | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/wrenchboard/src/shared_tool/media.cc b/wrenchboard/src/shared_tool/media.cc index 46628694..77db8e8b 100644 --- a/wrenchboard/src/shared_tool/media.cc +++ b/wrenchboard/src/shared_tool/media.cc @@ -51,23 +51,16 @@ long WrenchFindStoredMedia(CVars in, CVars &out) { char vname[500]; char file_section[50]; try { - REQ_STRING(in, "file_section", 5, 40, "(.*)"); REQ_STRING(in, "sessionid", 3, 150, "(.*)"); REQ_STRING(in, "file_uid", 3, 150, "(.*)"); - long file_section_no = REQ_LONG( in, "file_section_no", 1, -1 ); - + long file_section_no = REQ_LONG( in, "file_section", 1, -1 ); snprintf(file_section, sizeof (file_section), "%s", in["file_section"].c_str()); switch(file_section_no){ case WRENCH_FILE_PROFILE: //file_uid is the UID of the user - /* - REQ_STRING(in, "profile", 5, 40, "(.*)"); - pgsql_exec("UPDATE members SET profile_pic='%s' " - " WHERE uid='%s'",in["profile"].c_str(), in["file_uid"].c_str()); - */ - snprintf(vname, sizeof (vname), "SELECT * FROM members WHERE uid ='%s'", in["file_uid"].c_str()); + snprintf(vname, sizeof (vname), "SELECT profile_pic AS saved_file_name FROM members WHERE uid ='%s'", in["file_uid"].c_str()); break; case WRENCH_FILE_MYFILE: @@ -81,7 +74,8 @@ long WrenchFindStoredMedia(CVars in, CVars &out) { break; case WRENCH_FILE_FAMILY: - snprintf(vname, sizeof (vname), "SELECT * FROM members WHERE id =1", in["file_uid"].c_str()); + snprintf(vname, sizeof (vname), "SELECT profile_pic AS saved_file_name " + " FROM members WHERE id = (SELECT family_member_id FROM members_family WHERE uid = '%s')", in["file_uid"].c_str()); break; } diff --git a/www-api/app/Controllers/WrenchMedia.php b/www-api/app/Controllers/WrenchMedia.php index 32409e45..99c892b2 100644 --- a/www-api/app/Controllers/WrenchMedia.php +++ b/www-api/app/Controllers/WrenchMedia.php @@ -128,8 +128,15 @@ class WrenchMedia extends BaseController break; } // MAKE SURE FOLDER AS PER PROCESS IS AVAILABLE + log_message('critical', "wrenchboard_api-CALL MEDIA selectedFile DATA ---> ".$selectedFile ); - log_message('critical', "wrenchboard_api-CALL MEDIA selectedFile DATA".$selectedFile ); + if ( $out["saved_file_name"] =='' || !file_exists( $selectedFile) ){ + log_message('critical', "wrenchboard_api-CALL MEDIA selectedFile DATA ERROR NO FOUND---> ".$selectedFile ); + } + else + { + + } $file = FCPATH.'/assets/images/books.png'; diff --git a/www-api/app/Models/UploadManager.php b/www-api/app/Models/UploadManager.php index b82c45f5..62467d6d 100644 --- a/www-api/app/Models/UploadManager.php +++ b/www-api/app/Models/UploadManager.php @@ -112,7 +112,7 @@ class UploadManager extends Model fwrite($myfile, $file_data); fclose($myfile); $out["call_backend"] = false; // flag ready to save data entry - $data['file_uid'] = $in["uid"]; + $data['uid'] = $in["uid"]; $data['profile'] = $in["profile"]; $data['family_uid'] =$in["family_uid"]; $data['sessionid'] =$in["sessionid"];