Php Laravel 5.1:can';不要上传视频文件

Php Laravel 5.1:can';不要上传视频文件,php,laravel-5,laravel-5.1,laravel-form,Php,Laravel 5,Laravel 5.1,Laravel Form,提交文件时,我出现以下错误: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'video_ogg' cannot be null (SQL: insert into `profiles` (`about_me`, `video_ogg`, `updated_at`, `created_at`) values (lorem, , 2017-07-23 02:15:50, 2017-07-23 02:15:50)) 这表明

提交文件时,我出现以下错误:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'video_ogg' cannot be null (SQL: insert into `profiles` (`about_me`, `video_ogg`, `updated_at`, `created_at`) values (lorem, , 2017-07-23 02:15:50, 2017-07-23 02:15:50))
这表明字段
video\u ogg不能为空
,但当我在调试模式下验证时,该字段不是空的(见下文)

控制器

    public function store(Request $request)
   {
      // Validation //
      $validation = Validator::make($request->all(), [
         'about_me' => 'required',
         'video_ogg'    => 'required|mimes:mp4,ogx,oga,ogv,ogg,webm|min:1|max:3240',
      ]);

      // Check if it fails //
      if( $validation->fails() ){
         return redirect()->back()->withInput()
                          ->with('errors', $validation->errors() );
      }

      $profile = new Profile;

      //Debugging
      dd($request->files);

      // save media data into database //
      $profile->about_me = $request->input('about_me');
      $profile->video_ogg = $request->input('video_ogg');
      $profile->save();

      return redirect('/profile')->with('message','You just created your profile!');
   }
调试结果

FileBag {#45 ▼
  #parameters: array:1 [▼
    "video_ogg" => UploadedFile {#30 ▼
      -test: false
      -originalName: "mov_bbb.ogg"
      -mimeType: "audio/ogg"
      -size: 614492
      -error: 0
    }
  ]
}
在这里,你可以看到调试视频上传或我的意思是在请求数组中,但我仍然有一个错误消息

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'video_ogg' cannot be null (SQL: insert into `profiles` (`about_me`, `video_ogg`, `updated_at`, `created_at`) values (lorem, , 2017-07-23 02:15:50, 2017-07-23 02:15:50))
看法


我想你应该用
file
方法而不是
input

我想你应该使用
文件
方法,而不是
输入

您是否已将
video\u ogg
设置为可在您的模型上填充?您是否可以尝试
dd($request->input('video\u ogg'))
并发布结果?@VandolphReyes这是空的,如何
$v_ogg=$request->input('video_ogg')dd(v_ogg->mimeType)
@VandolphReyes试图获取非对象的属性您是否已将
video_ogg
设置为可在您的模型上填充?您是否可以尝试
dd($request->input('video_ogg')
并发布结果?@VandolphReyes这是空的呢
$v_ogg=$request->input('video_ogg')dd(v_ogg->mimeType)
@VandolphReyes试图获取非对象的属性
{!! Form::open(['url'=>'/profile', 'method'=>'POST', 'files'=>'true']) !!}
...
      <div class="form-group">
         <label for="video_ogg">Upload Video (ogg)</label>
         <input type="file" class="form-control" name="video_ogg">
      </div>
...
<form method="POST" action="http://localhost:8000/profile" accept-charset="UTF-8" enctype="multipart/form-data"><input name="_token" type="hidden" value="KxvK6tONoUhBCx58ESlbE1hh9eP8hy5nQyNqb62W">
class Profile extends Model
{
    //
    protected $fillable = ['video_ogg', 'about_me'];
}