Open og6k opened 6 years ago
There is an issue right now for upload file as public to s3. As a result, everything is uploaded as private. You can't view it unless you create your own controller that redirect to a signed s3 URL.
public function getTempUrl(Request $request)
{
// s3 doesn't like path start with '/'
$path = trim($request->query('path'), '/');
$disk = \Storage::disk('s3-public');
$url = $disk->temporaryUrl($path, Carbon::now()->addMinutes(5));
return redirect($url);
}
// then route map it
Route::get('/files/cloud-private', '\Api\Controllers\FileController@getTempUrl');
// to get this to work with s3, set inside of elfinder.php
// dir must be empty, because it will conflict with disks URL config later
'dir' => [],
'disks' => [
// this name must match with disk name in the filesystems.php
's3-disk-name' => [
'URL' => '/files/cloud-private?path='
]
,
// make sure this configuration is correct inside of filesystems.php
'disks' => [
// this name must match with elfinder.php
's3-disk-name' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => 'http://' . env('AWS_BUCKET') . '.s3.' . env('AWS_DEFAULT_REGION') . '.amazonaws.com',
// elfinder should read this attribute, but it does not
'visibility' => 'public',
]
]
When I config my s3, I get the wrong url call out as
http://mysite.com/elfinder/connector?_token=DE1hdPclHMyBabxoEu46bWIZG1tlorw3J35641yO&cmd=file&target=fls2_RnJvbnRfcGFnZS9tZWRpdGF0aW5nVW5pY29ybi5wbmc
I can upload and see files on my s3 bucket with no problem. The only thing is I can't see the url via my s3 url.
in my config file I have my disk displayed as:
` <?php
return array(
); `
I set up the environment to use local and production filesystems. my filesystem_driver is S3 for production.
I have been trying to figure out where to setup the url, but I can't figure it out. It still throws the connector?token= string.
How do I change the base url for s3 uploads?