donglipi4495 2016-09-22 09:41
浏览 43
已采纳

使用laravel 5.2显示视频

I am working on Laravel 5.2. I have to display a video on my view page.I am able to store the video in my database table but, not able to fetch it and display it.I have the column in my table having the filepath of the videos which i am using to fetch it from the database.

My Controller:

   public function talent(Request $request){
   $user=new Talent(); 
   $this->validate($request, [

     'video'=>'required',
   ]);
   $video=$request->file('video');


   $filename=time().'.'. $video->getClientOriginalExtension();
   $pathVideo = public_path('uploads/video/' . $filename);
   Input::file('video')->move('uploads/video/', $pathVideo);
   $user->file_path=$pathVideo;


   $user->video=$filename;

   $user->user_id=Auth::user()->id;
   $user->save();

    return redirect()->back();

    }

   public function talentpool($id){
   $user=User::findorFail($id);
   $talents=Talent::orderBy('created_at','desc')->get();
   return view('talentpool',['user'=>$user,'talents'=>$talents]);
    }

My View:

   @foreach($talents as $talent)
   <video width="616" src="{{ $talent->file_path }}" controls></video>
   @endforeach
  • 写回答

2条回答 默认 最新

  • donglu6805 2016-10-20 05:45
    关注

    php.ini files contains some limits that might affect this. Try changing these to high enough values:

    upload_max_filesize = 10M
    post_max_size = 10M
    memory_limit = 32M
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?