Php 将上载文件的名称更改为s3
我使用下面的代码将映像存储到S3磁盘。但是使用这段代码,我得到了一个随机的名字,即我上传的图像的文件名。那么,如何在上传时设置Php 将上载文件的名称更改为s3,php,laravel-5,amazon-s3,Php,Laravel 5,Amazon S3,我使用下面的代码将映像存储到S3磁盘。但是使用这段代码,我得到了一个随机的名字,即我上传的图像的文件名。那么,如何在上传时设置$request->renter\u-proof的文件名?有人请帮忙 $storagePath = Storage::disk('s3') ->put('/company/'.Auth::user()->company.'/renter-proof/', $request->renter_proof, 'p
$request->renter\u-proof
的文件名?有人请帮忙
$storagePath = Storage::disk('s3')
->put('/company/'.Auth::user()->company.'/renter-proof/',
$request->renter_proof,
'public');
我希望文件名为:
$imageName = 'Tag '.$request->input('stock_on_rent').'.'.$request->renter_proof->getClientOriginalExtension();
解决方案是使用putFileAs() 我使用了以下代码:
$path = "/company/".Auth::user()->company."/renter-proof";
$imageName = 'Tag '.$request->input('stock_on_rent').'.'.$request->renter_proof->getClientOriginalExtension();
$storagePath = Storage::disk('s3')->putFileAs($path,$request->renter_proof,$imageName ,'public');