From 553ebe3b83cbeff51df8a383c1dd64ee124f2cac Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 20 Oct 2022 12:40:59 +0200 Subject: [PATCH] Add upload example script --- update-example.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 update-example.php diff --git a/update-example.php b/update-example.php new file mode 100644 index 0000000..c49783b --- /dev/null +++ b/update-example.php @@ -0,0 +1,21 @@ +auth, hash('sha256', $data->nonce . $secret))) { + http_response_code(404); + exit(); +} + +$file = explode('.', $data->filename); +$file[0] = preg_replace("/[^a-z0-9]/", '', $file[0]); +if (count($file) === 2 && in_array($file[1], $whitelist) && ! empty($file[0])) { + if ($data->encoding === 'base64') { + // Decode uploaded images + $data->content = base64_decode($data->content); + } + file_put_contents(__DIR__ . "/$file[0].$file[1]", $data->content); +}