Skip to content

Commit

Permalink
Fix file extension validation to use original filename
Browse files Browse the repository at this point in the history
The file extension validation was checking the temporary file path
which doesn't have an extension. This fix changes it to check the
original filename's extension instead, allowing proper validation
of uploaded files.
  • Loading branch information
screenfluent committed Nov 22, 2024
1 parent aa40236 commit 3c5fbe2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/FS/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public static function upload($file, string $destination, array $options = [])

if ($options['validate']) {
$fileType = static::type($temp);
$fileExtension = (new Path($temp))->extension();
$fileExtension = (new Path($file['name']))->extension(); // Changed from $temp to $file['name'] to fix extension validation

if (
!empty($options['allowedTypes']) &&
Expand Down

0 comments on commit 3c5fbe2

Please sign in to comment.