亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

php - larvael5.4 file upload error
ringa_lee
ringa_lee 2017-06-30 09:56:37
0
1
846

Controller code:

public function doUpload(Request $request)
    {
        //判斷是否是一個有效上傳文件
         if ($request->input('picname') && $request->input('picname')->isValid()) {
            //獲取上傳文件信息
            $file = $request->input('picname');
            /*print_r($file);*/
            $ext = $file->extension(); //獲取文件的擴展名
            //隨機一個新的文件名
            $filename = time().rand(1000,9999).".".$ext;
            //移動上傳文件
            $file->move("./upload/",$filename);
                                
            return response($filename); //輸出
            exit();
        }else{
            //閃存信息
            return redirect('demo/upload')->with('status', '請選擇上傳文件!');
        }
    }
error:Call to a member function isValid() on string
in FilmController.php (line 59)
at FilmController->doUpload(object(Request))
at call_user_func_array(array(object(FilmController), 'doUpload'), array(object(Request)))
in Controller.php (line 55)
ringa_lee
ringa_lee

ringa_lee

reply all(1)
phpcn_u1582

$request->input('picname')->isValid()
Call to a member function isValid() on string
The prompt is the error reported at this location! Print it yourself and tune it in!
Should: $request->file('picname')->isValid();

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template