🔹 1. Upload to Remote Server Endpoint: POST http://173.212.230.192/profile/task_attachNew.php 🔸 Payload Format (JSON): json Copy Edit { "postk": "USER101", "encoded_string4": "", "user_file": "example.pdf", "newFileName": "optional_new_name.pdf", "userExa": "GC12345", "ser_refer": "", "room_id": "ROOM01", "maintas": "TASK123", "time": "", "date": "2025-06-24", "extension": "pdf", "heada": "Document Attachment", "attachment_note": "Notes if any", "parent": "login/files" } 🔸 Success Response: json Copy Edit { "success": true, "url": "profile/login/files/USER101/ROOM01/TASK123/example.pdf", "savedAs": "example.pdf" } 🔹 2. File Action APIs Endpoint: POST http://yourdomain.com/api/fileAction.php 🔸 Available Request Types: ✅ A. Delete Single File json Copy Edit { "requestType": "single_file", "file_url": "profile/login/files/USER101/ROOM01/TASK123/example.pdf" } ✅ B. Delete Entire Folder with All Subfolders and Files json Copy Edit { "requestType": "delete_directory", "directory": "profile/login/files/USER101/ROOM01" } ✅ C. Clean Folder (Keep structure, remove files) json Copy Edit { "requestType": "clean_directory", "directory": "profile/login/files/USER101/ROOM01" } ✅ D. Rename File json Copy Edit { "requestType": "rename", "file_url": "profile/login/files/USER101/ROOM01/oldname.pdf", "old_name": "oldname.pdf", "new_name": "newname.pdf", "extension": "pdf" } ✅ E. Rename Folder (Add optional implementation) You can add logic to renameDirectory($oldPath, $newPath) in the handler. 🔸 Common Response: json Copy Edit { "re_file": "successfully deleted", "re_state": "delete" } 🔹 3. cURL Helper Function Use this to call any of the above endpoints programmatically: php Copy Edit function makeCurlRequest($url, $method = 'POST', $data = [], $headers = []) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($method)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge(['Content-Type: application/json'], $headers)); if (!empty($data)) { curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); } $response = curl_exec($ch); $error = curl_error($ch); curl_close($ch); return [ 'error' => $error, 'response' => json_decode($response, true) ]; } 🔹 4. File Log Tracking Path: /upload_logs.txt Each uploaded file is logged in format: yaml Copy Edit 2025-06-24 13:45:12 | FileCm_abc123.pdf | USER101 | GC12345 Use this to monitor or retrieve old uploads. 🔹 5. Database Recording (Optional) Function: func_file_record($metadata, $fileUrl, $poster, $gc_tag, $conn) Metadata Structure: json Copy Edit { "file_name": "example.pdf", "user_file_refer": "REF123", "room_id": "ROOM01", "taskId": "TASK123", "gc_tag": "GC12345", "itemType": "image", "item": "communityAttach", "parent": "proTask", "exten": "pdf", "fsize": "200KB" } Returns: "insert_success" or "insert_failed" depending on DB response.