mardi 20 novembre 2018

Save and retrieve file in Laravel

I have difficulty understanding the file save and retrieval in Laravel. I managed to get thwe file saved in the correct path

  $fileNameWithExt = $request->file('Agreement_file')->getClientOriginalName();
      $fileName = pathinfo($fileNameWithExt, PATHINFO_FILENAME);
      $extention  =$request->file('Agreement_file')->getClientOriginalExtension();
      $filenameToStore = $fileName . '_' . $lab_id. '.'.$extention;
      $request->Agreement_file->storeAs('agreements', $filenameToStore );

However not I want to create an a-tag to download the file, but cannot manage to get to download the file.

<a href="/storage/app/public/agreements/'. " download=""></a>

The file download but I get the error "Failed- Server Problem". I do not want to use a symlink as these files are confindential and should not be able to be downloaded outside the app.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire