Skip to content

Commit 1882a7c

Browse files
committed
feat: restore uploadAs
1 parent 2be5cbb commit 1882a7c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/Request.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,22 @@ public static function upload(string $key, string $destination, array $config =
396396
return $fileSystem->uploadInfo($uploadedFile);
397397
}
398398

399+
/**
400+
* Store a file from the request with a given name
401+
*
402+
* @param string $key The name of the file input the request.
403+
* @param string $destination The directory where the file should be stored.
404+
* @param string $name The name to store the file as.
405+
* @param array $config Optional configurations: max_file_size, file_type, extensions
406+
*/
407+
public static function uploadAs(string $key, string $destination, string $name, array $config = [])
408+
{
409+
$config['name'] = $name;
410+
$config['rename'] = true;
411+
412+
return static::upload($key, $destination, $config);
413+
}
414+
399415
/**
400416
* Get Content Type
401417
* @return string|null

0 commit comments

Comments
 (0)