diff --git a/workflow_v3.php b/workflow_v3.php index 78bd6fb..dcfe391 100644 --- a/workflow_v3.php +++ b/workflow_v3.php @@ -340,6 +340,45 @@ if ($_POST && $testRunner) { $currentTab = 'upload'; break; + case 'test_upload_to_folder': + // Test upload to specific folder provided by Ferrero team + $testFolderId = $_POST['test_folder_id'] ?? 'e96080ba0cd1427d253a28a87504b6665eaa02cb'; + + if (isset($_FILES['test_upload_file'])) { + $tmpName = $_FILES['test_upload_file']['tmp_name']; + $fileName = $_FILES['test_upload_file']['name']; + $fileError = $_FILES['test_upload_file']['error']; + + if ($fileError === UPLOAD_ERR_OK) { + $apiClient = new ApiClient(); + $configV3 = new ConfigV3(); + $apiClient->setBaseUrl($configV3->getBaseUrl()); + + $oauth2Handler = new ReflectionProperty($testRunner, 'oauth2Handler'); + $oauth2Handler->setAccessible(true); + $oauth2HandlerInstance = $oauth2Handler->getValue($testRunner); + if ($oauth2HandlerInstance) { + $apiClient->setHeader('Authorization', $oauth2HandlerInstance->getAuthHeader()); + } + + $uploader = new AssetUploader($apiClient, $testFolderId); + $result = $uploader->uploadFile($tmpName, $testFolderId, [], null, $testRunner); + + $results['test_upload_result'] = $result; + $results['test_folder_id'] = $testFolderId; + + if ($result['success']) { + $success = "โœ… TEST UPLOAD SUCCESSFUL to folder {$testFolderId}!"; + } else { + $error = "Test upload failed: " . $result['error']; + } + } else { + $error = "File upload error: " . $fileError; + } + } + $currentTab = 'upload'; + break; + case 'upload_files': if (isset($_FILES['upload_files']) && isset($results['upload_folder_id'])) { // Get selected master asset lightweight data @@ -1758,6 +1797,58 @@ $envInfo = $configV3->getEnvironmentInfo(); Load campaigns with status A2 (assets sent to agency), upload processed files, and update status to A3

+ +
+

๐Ÿงช Test Upload to Specific Folder

+

+ Upload directly to a folder ID for testing (bypasses campaign workflow) +

+ +
+ + + +
+ + +
+ +
+ + +
+ + +
+ + + +
+ + โœ… TEST UPLOAD SUCCESSFUL!
+ Filename:
+ Asset ID:
+ Folder: + + โŒ Test Upload Failed:
+ HTTP Code:
+ Folder: + +
+ View API Response +
+
+ + +
+ +
+
+ +