jeudi 11 février 2021

How to download files directly from amazone s3

This is my file uploading function

$file = $req->file('upload_file');
$name = $file->getClientOriginalName();
$fileName = time() . rand(1, 10000) . '_' . $name;
if($file )
{
$storage = \Storage::disk('s3')->put($fileName, file_get_contents($file), 'public');
}
if ($storage) {
$savePdf = Pdf_exports::create(
 [
   'pdf_name'      => $fileName,
 ]);
 }

Iam using jquery datatable to list the files and here below is my download link

 $('td:eq(6)', nRow).html('<div class="actionGrp"><a href="' + URL_general + '/dowlnoadPdf?id=' + aData.id + '" data-tooltip="tooltip" data-placement="top" title="Download"><span class="fa fa-download"></span></a></div>').addClass('txt-center');

I want a function to download the pdf directly when clicking the the download option.. Please help me..Iam less familiar with Amazone s3 bucket and file uploading



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire