Reputation: 9289
I would like to upload a file, and specify both the name of the file, and the disk.
With Storage::putFileAs
I am able to specify the file name, but not the disk, and with file('...')->store(...)
I can specify the disk, but not the file's name, only the directory.
How is it possible to set both? I was not able to find any detailed documentation about these functions, only the one about the filesystem on the Laravel's site. I am looking for a function like this:
fun($uploaded_file, $dir_name, $file_name, $disk_name)
Upvotes: 2
Views: 959
Reputation: 45
$request->file('file')->store('folder', 's3');
where second argument is the disk name.
Upvotes: -1
Reputation: 199
use the storage facade disk
method.
Storage::disk($disk_name)->path($path)->saveFileAs($file_name);
Or you can use the store
method.
Hope this helps. Good luck
Upvotes: 2
Reputation: 4738
The storage facade has a disk
method.
Storage::disk('s3')->putFileAs(...);
Upvotes: 1