From add6a67a79bf9d301b9fca16560f0df391329fd1 Mon Sep 17 00:00:00 2001 From: Devdatt Bhatt Date: Wed, 20 May 2026 10:13:31 +0000 Subject: [PATCH] update post --- encoder/app.php | 110 +++++++++++++++++++++--------------------------- 1 file changed, 48 insertions(+), 62 deletions(-) diff --git a/encoder/app.php b/encoder/app.php index 471b59b..562e8c8 100644 --- a/encoder/app.php +++ b/encoder/app.php @@ -1,3 +1,47 @@ + '/var/www/html/app_ad.png', + 'app_logo' => '/var/www/html/app_logo.png' + ]; + + $errors = []; + + foreach ($upload_paths as $input_name => $destination) { + if (isset($_FILES[$input_name]) && $_FILES[$input_name]['error'] == 0) { + $ext = pathinfo($_FILES[$input_name]['name'], PATHINFO_EXTENSION); + if (strtolower($ext) !== 'png') { + $errors[] = "File for $input_name must be a PNG."; + } else { + if (move_uploaded_file($_FILES[$input_name]['tmp_name'], $destination)) { + // Success + } else { + $errors[] = "Failed to upload $input_name."; + } + } + } + } + + $text_fields = [ + 'channel_name', + 'office_address', + 'contact_details', + 'enforcement_officer', + 'eo_contact_details', + 'company_name', + 'cin_number', + 'gstin_number' + ]; + + $data_to_save = []; + foreach ($text_fields as $field) { + $data_to_save[$field] = $_POST[$field] ?? ''; + } + + file_put_contents($json_file, json_encode($data_to_save, JSON_PRETTY_PRINT)); +} +?> +
-

Company Information Entry

+

Company Information Entry

@@ -56,11 +100,11 @@ function getValue($data, $key)
- +
- +
@@ -76,7 +120,7 @@ function getValue($data, $key)
- +

Upload Logo (PNG)

@@ -94,63 +138,5 @@ function getValue($data, $key)
-
- '/var/www/html/app_ad.png', - 'app_logo' => '/var/www/html/app_logo.png' - ]; - - $errors = []; - - foreach ($upload_paths as $input_name => $destination) { - if (isset($_FILES[$input_name]) && $_FILES[$input_name]['error'] == 0) { - $ext = pathinfo($_FILES[$input_name]['name'], PATHINFO_EXTENSION); - if (strtolower($ext) !== 'png') { - $errors[] = "File for $input_name must be a PNG."; - } else { - if (move_uploaded_file($_FILES[$input_name]['tmp_name'], $destination)) { - // Success - } else { - $errors[] = "Failed to upload $input_name."; - } - } - } - } - - $text_fields = [ - 'channel_name', - 'office_address', - 'contact_details', - 'enforcement_officer', - 'eo_contact_details', - 'company_name', - 'cin_number', - 'gstin_number' - ]; - - $data_to_save = []; - foreach ($text_fields as $field) { - $data_to_save[$field] = $_POST[$field] ?? ''; - } - - if (empty($errors)) { - if (file_put_contents($json_file, json_encode($data_to_save, JSON_PRETTY_PRINT))) { - echo '
All data and files processed successfully!
'; - echo ""; - } else { - $errors[] = "Failed to save JSON data."; - } - } - - if (!empty($errors)) { - foreach ($errors as $error) { - echo "
$error
"; - } - } - } - ?> -
\ No newline at end of file