inzmam
13
24
Laravel

Unable to upload video file

Posted 10 months ago by inzmam

When i am going to upload a video file i m getting an error as "SQLSTATE[HY000]: General error: 1364 Field 'filename' doesn't have a default value (SQL: insert into video_stores (updated_at, created_at) values (2018-03-16 04:14:58, 2018-03-16 04:14:58))".

I don't why this error is being thrown, however i am passing all the values. Please help me in this case.

HomeController:- 'public function uploadVideo(Request $request) { $vid=new VideoStore; if($request->hasFile('Upload_video')) { $video=$request->file('Upload_video'); $filename=time().'.'.$video->getClientOriginalExtension(); $location=public_path('video/'.$filename);

        //Image::make($video)->resize(400,200)->save($location);
       
        $vid->move($location,$filename);
        $vid->filename='inzmam';
         $vid->path='ul haq';
        
    }
    $vid->save();
    Session::flash('success','Your video has been uploaded');
    return redirect()->route('pages.index');
}'

Migration:-

'public function up() { Schema::create('video_stores', function (Blueprint $table) { $table->increments('id'); $table->string('filename'); $table->string('path'); $table->timestamps(); }); }

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::dropIfExists('video_stores');
}'.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.