Laravel 5.3中的文件上载错误(错误调用成员函数move()为null)

时间:2016-12-12 06:26:17

标签: php file-upload laravel-5.3

我正在为我的应用程序编写文档上传代码。如果我尝试执行它,我会收到以下错误,即(在null上调用成员函数move())。 任何人都建议我在哪里出错。

以下是我的 DocumentInsertController 文件。

<?php

        namespace App\Http\Controllers;

        use Illuminate\Http\Request;

        class DocumentInsertController extends Controller
        {
              public function insertform(){
              return view('document');
           }

           public function insert(Request $request){
              $destinationPath = app_path()."/gstup";
              $DocumentName = $request->input('DocumentName');
              $photup=$request->file('DocumentImage')->move($destinationPath);
              $VendorId = $request->input('VendorId');
              //$request->file('photo')->move($destinationPath, $fileName);
              $now = new DateTime();
              DB::insert('insert into documentmaster (DocumentName, photup, VendorId, UploadedDateTime) values(?, ?, ?, ?)',[$DocumentName, $VendorId, $photup, $now]);

                   echo "Record inserted successfully.<br/>";
                   echo '<a href = "/DOCUMENT">Click Here</a> to go back.';

           }
        }

0 个答案:

没有答案