Error downloading AWS S3 Laravel 5.6

0

I can not download file after clicking the href link

ERROR

TRIALCONTROLLERNote:requestarrivesatthefilename

publicfunctiondownload(Request$request){$file=Storage::disk('s3')->get('message_attachments/'.$request->filename);$headers=['Content-Type'=>'text','Content-Description'=>'FileTransfer','Content-Disposition'=>"attachment; filename={$request->filename}",
        'filename'=> $request->filename
    ];

    return response($file, 200, $headers);
}

CALL PRO CONTROLLER VIA HTML5

<a href="{{ route('download', $attachment->filename) }}" class="btn btn- 
       default btn-xs pull-right"  >
  <i class="fa fa-cloud-download"></i>

                                            

NOTE: route ('download', $ attachment-> filename) is redirected to the above controller, already verified.

NOTE: I have tried to do this as follows

<a href="link do arquivo na amazon correto" DOWNLOAD="nome do arquivo"> Teste </a>

And it did not work, it just opens the photo or the text file !!

    
asked by anonymous 29.03.2018 / 19:08

0 answers