1

I'm new to Laravel 5.4 and I need to download few PDF files from its database. There's an issue downloading the files.

enter image description here

Here is my controller.

 public function download_files(){
    $dowaloads=DB::table('dowanloadable_files')->get();
    return view('dowanload.dowanload', compact('dowaloads'));
}

Here is my view.

 <tbody> 
    @foreach($dowaloads as $download)
     <tr>
      <td>{{ $download->file_title }}</td>
      <td><a href="download/{{ $download->file_name }}" download="{{ $download->file_name }}"> <button type="button" class="btn btn-primary">Dowanload</button></a></td>
      </tr>
    @endforeach

i place all these PDF files in public/download directory as well but this problem not changed. Is this due to no files in the database?

Here is the database screen. enter image description here

Here is my download directory . enter image description here

Dasun
  • 602
  • 1
  • 11
  • 34
  • Show your download folder. – Pankit Gami Apr 22 '17 at 06:36
  • Sir, download folder means?when i press download and then downloading place? or just download directory? – Dasun Apr 22 '17 at 06:42
  • Just download directory. – Pankit Gami Apr 22 '17 at 06:42
  • Where are you handling the download request on the code? Like when some one presses the download link, what's the route and controller for that? Can you show us the code. For reference see this http://stackoverflow.com/questions/20415444/download-files-in-laravel-using-responsedownload – Luzan Baral Apr 22 '17 at 06:46
  • @LuzanBaral actually i dont know how to do that,i just follow the youtube tutorial .can you please suggest me it ? – Dasun Apr 22 '17 at 06:48

1 Answers1

0

You are using wrong folder name use like this, seen in your download folder image.

  <td><a href="/dowanload/{{ $download->file_name }}" download="/dowanload/{{ $download->file_name }}"> <button type="button" class="btn btn-primary">Dowanload</button></a></td>
GRESPL Nagpur
  • 2,048
  • 3
  • 20
  • 40