Skip to content

Commit

Permalink
Merge pull request #178
Browse files Browse the repository at this point in the history
dev
  • Loading branch information
leonardosahon authored Oct 17, 2024
2 parents f212edc + 989ad58 commit e959fae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/Libs/FileUpload/FileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function __construct(
)
{
$req = $this->check_all_requirements(
post_name: $opts['post_name'],
post_name: $opts['post_name'] ?? null,
custom_mime: $opts['custom_mime'] ?? null,
extension_list: $opts['extension_list'] ?? null,
);
Expand Down Expand Up @@ -193,13 +193,16 @@ private function upload_response(
* @throws \Exception
*/
private function check_all_requirements(
string $post_name,
?string $post_name,
?int $file_limit = null,
FileUploadExtension|null|string $extension = null,
?array $custom_mime = null,
?array $extension_list = null,
) : ?array
{
if(!$post_name)
return null;

if(!isset($_FILES[$post_name]))
return $this->upload_response (
false,
Expand Down
2 changes: 1 addition & 1 deletion src/Libs/FileUpload/Traits/Doc.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public function doc_upload(

if(
$check = $this->check_all_requirements(
$post_name,
$post_name ?? null,
$file_limit ?? null,
$extension ?? null,
$custom_mime ?? null
Expand Down
2 changes: 1 addition & 1 deletion src/Libs/FileUpload/Traits/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function image_upload(

if(
$check = $this->check_all_requirements(
$post_name,
$post_name ?? null,
$file_limit ?? null,
)
) return $check;
Expand Down

0 comments on commit e959fae

Please sign in to comment.