server_...">

The public path contains a list of all files

I am pasting the pdf file in my opinion, like

<embed src = "{{$pdfUrl.$accessProfileDet->server_folder}}" width="100%" height="600px" type="application/pdf">

      

It works great if the variable $accessProfileDet->server_folder

has a value. $pdfUrl

- my public path. If $accessProfileDet->server_folder

null, the view lists all files in the shared folder. Please suggest any easy solution for this. Since my images, such as the site logo, banner, etc., are in a shared folder, I don't like to prefer a special route to address this issue. Is there an alternative solution.

+3


source to share


1 answer


Just place a blank html file named 'index.html' in your public folder. This will solve the issue. Also you can avoid embedding the code by an if condition like this,
@if($accessProfileDet->server_folder != '')
    <embed src="{{$pdfUrl.$accessProfileDet->server_folder}}" width="100%" height="600px" type="application/pdf">
@else
    <div class="no-pdf">No data available!</div>
@endif

      



+1


source







All Articles