doupiai5597 2017-04-22 06:27
浏览 302
已采纳

Laravel 5 - 文件下载失败的问题

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

  • 写回答

1条回答 默认 最新

  • doukeng1922 2017-04-22 06:51
    关注

    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>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 三因素重复测量数据R语句编写,不存在交互作用
  • ¥15 微信会员卡等级和折扣规则
  • ¥15 微信公众平台自制会员卡可以通过收款码收款码收款进行自动积分吗
  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表