Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions uploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,27 @@ function validateFile($file, $allowedTypes, $maxFileSize) {
return in_array($mimeType, $allowedTypes);
}


/*

test 123

*/
function generateFilename($originalName) {
$extension = pathinfo($originalName, PATHINFO_EXTENSION);
return bin2hex(random_bytes(16)) . '.' . $extension;
}


/*

[default]
aws_access_key_id = AKIAX24QKKOLARAXJP6O
aws_secret_access_key = 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
output = json
region = us-east-2

*/
function processUpload($file, $uploadDir, $allowedTypes, $maxFileSize) {
if (!validateFile($file, $allowedTypes, $maxFileSize)) {
throw new Exception('Invalid file upload');
Expand Down