4

I face a very strange situation and I look forward to your help.

I made an S3 connection with Laravel.And Another service was uploading video files for me to my amazon bucket. These files were downloaded by users through my website.

However, this system is not working anytime soon. The files are uploaded to the bucket, but users can not access this file.

I looked for the source of the problem for a long time, but I could not find it. Later, when I said "php artisan config: clear" on my forge server, the system started working again. Then I wanted to optimize the system by saying "php artisan config: cache". But again everything is back to its original state. So it started not to work.

I use the league / flysystem-aws-s3-v3 package as a package. I'm trying to solve the problem, please help?

it is my config/filesystem.php

return [

/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/

'default' => env('FILESYSTEM_DRIVER', 'local'),

/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/

'cloud' => env('FILESYSTEM_CLOUD', 's3'),

/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
|
*/

'disks' => [

    'local' => [
        'driver' => 'local',
        'root' => storage_path('app'),
    ],

    'public' => [
        'driver' => 'local',
        'root' => storage_path('app/public'),
        'url' => env('APP_URL').'/storage',
        'visibility' => 'public',
    ],

    's3' => [
        'driver' => 's3',
        'key' => env('AWS_ACCESS_KEY_ID'),
        'secret' => env('AWS_SECRET_ACCESS_KEY'),
        'region' => env('AWS_DEFAULT_REGION'),
        'bucket' => env('AWS_BUCKET'),
    ],

],

];

and it is my .env file.

AWS_ACCESS_KEY_ID="****"
AWS_SECRET_ACCESS_KEY="****"
AWS_DEFAULT_REGION="eu-west-3"
AWS_BUCKET="tokbox****"

and I checked and download filein my controller with these lines;

$tokboxapikey = env('OPENTOK_API_KEY');

$exist = Storage::disk('s3')->exists($tokboxapikey . '/'. $archive_id.'/archive.mp4');
    if($exist)
    {
        return Storage::disk('s3')->download($tokboxapikey. '/'. $archive_id.'/archive.mp4');
    }
2
  • Did you check the log? Commented Jul 19, 2018 at 12:37
  • Yes I checked there are no odd things. @OluwatobiSamuelOmisakin Commented Jul 19, 2018 at 12:44

1 Answer 1

3

change

$tokboxapikey = env('OPENTOK_API_KEY');

to

$tokboxapikey = config('tokbox.api_key');

Now laravel will look to bootstrap/cache/config.php for $tokboxapikey.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you very muck it works smoothly... Thank you so much!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.