国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

php - larvael5.4 文件上傳 error
ringa_lee
ringa_lee 2017-06-30 09:56:37
0
1
848

控制器代碼:

public function doUpload(Request $request)
    {
        //判斷是否是一個有效上傳文件
         if ($request->input('picname') && $request->input('picname')->isValid()) {
            //獲取上傳文件信息
            $file = $request->input('picname');
            /*print_r($file);*/
            $ext = $file->extension(); //獲取文件的擴(kuò)展名
            //隨機(jī)一個新的文件名
            $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

全部回復(fù)(1)
phpcn_u1582

$request->input('picname')->isValid()
Call to a member function isValid() on string
提示是這個位置報的錯!自己打印 調(diào)調(diào)吧!
應(yīng)該:$request->file('picname')->isValid();

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板