dineshsuthar92's avatar

Unable to encrypt uploaded file on S3 using FileVault in Laravel 5.8?

I am using Laravel 5.8.

I am uploading a file on s3 which is successfully uploaded. But I am unable to encrypt using FileVault api.

enter image description here

Below are my configurations:

'kyc-documents' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'root' => 'app/kyc',
        ],

My controller code

$file_url = Storage::disk('kyc-documents')->putFileAs('/'.Auth::user()->id,$file,$filename);

            Log::info($file_url); // here it logs as 4/hitbtc_api_key.png


            FileVault::disk('kyc-documents')->encrypt($file_url); // Here it gives error as mentioned below

The error I am getting is as follows

fopen(app/kyc/4/hitbtc_api_key.png.enc): failed to open stream: No such file or directory {"userId":4,"exception":"[object] (ErrorException(code: 0): fopen(app/kyc/4/hitbtc_api_key.png.enc): failed to open stream: No such file or directory at /var/www/html/buy_sell/vendor/soarecostin/file-vault/src/FileEncrypter.php:170)

PS: While I am using local disk it is uploaded with .enc file extension which is correct way it should be. Only issue using s3 configurations in my fileSystem disk.

Please do help

0 likes
0 replies

Please or to participate in this conversation.