diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-04 21:02:51 +0400 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-04 21:02:51 +0400 |
| commit | d59e9b569fb828cdb145a3497c1b1f9e27cd03ad (patch) | |
| tree | f4f96c76ec2b6cc9a3aa42aba5efbf213b589143 /public/delete.php | |
| parent | 28658d12a464777b50c789c2e9c3f86ce8f07da0 (diff) | |
feat: verify file mime type
Diffstat (limited to 'public/delete.php')
| -rw-r--r-- | public/delete.php | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/public/delete.php b/public/delete.php index 26d91aa..b716796 100644 --- a/public/delete.php +++ b/public/delete.php @@ -46,17 +46,9 @@ if (!password_verify($password, $metadata['password'])) { exit(); } -$paths = [ - FILE_UPLOAD_DIRECTORY . "/{$file_id}.{$file_ext}", - FILE_THUMBNAIL_DIRECTORY . "/{$file_id}.webp", - FILE_METADATA_DIRECTORY . "/{$file_id}.metadata.json" -]; - -foreach ($paths as $path) { - if (is_file($path) && !unlink($path)) { - json_response(null, "Failed to delete a file ID {$file_id}", 500); - exit(); - } +if (!delete_file($file_id, $file_ext)) { + json_response(null, 'Failed to remove files. Try again later.', 500); + exit(); } json_response( |
