简体   繁体   中英

How is it possible to store uploaded file on a disk with a given name?

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)

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

存储外观具有disk方法。

Storage::disk('s3')->putFileAs(...);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM