【发布时间】:2019-10-22 04:35:26
【问题描述】:
我正在尝试使用this package,它可以满足我的所有需求。因此,除了我上传图片时,一切似乎都正常。 它根本不会用到 UtilsController@uploadfile 函数。
Route::post('/uploadfile', 'UtilsController@uploadfile');
public function uploadfile(Request $request){
$img = $request->img;
$newlocation = $request->newlocation;
$filename = $request->filename;
return file_put_contents ($newlocation . "/" . $filename , $img );
}
但是当我检查网络时,一切似乎都很好......
我得到这个错误:419 未知状态
有什么想法吗?
【问题讨论】:
-
听起来像 CSRF。在请求标头中是否有 csrf 令牌?您正在使用的库有一个使用 vue2 的标题部分,您可以像使用 ajax 一样将其删除:stackoverflow.com/questions/46466167/…
-
非常感谢,就是这样!