导入Excel文件时出错

时间:2016-03-13 09:53:00

标签: php excel import laravel-5.1

当我尝试使用laravel 5.1 maatweb软件包导入excel文件时,收到以下错误

序列化:

'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed

功能如下:

public function import()
    {
        $file=Input::file("file");

      // Excel::load($file, function($reader)
            Excel::load($file)->chunk(100, function($reader)
        {
            $results = $reader->get();
            foreach($results as $row):
               Vlist::create([
                    'vname'           =>$row->vname,
                    'vservice'        =>$row->vservice,
                    'vphone'          =>$row->vphone,
                    'vmobile'         =>$row->vmobile,
                    'vemail'          =>$row->vemail,
                    'vcontactperson'  =>$row->vcontactperson,
                    'vaddress'        =>$row->vaddress,
                    'vegpcno'         =>$row->vegpcno,
                    'vcapitallimit'   =>$row->vcapitallimit,
                    'vgrade'          =>$row->vgrade,
                    'vremarks'        =>$row->vremarks,
                    'user_id'        =>Auth::user()->id
                ]);
            endforeach;
        });
        return redirect('vlist');
    }

0 个答案:

没有答案