Reputation: 1056
I am trying to use this package, which does everything I want. So indeed everything seems to work except for when I upload my image. It's not going to UtilsController@uploadfile function at all.
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 );
}
But when I inspect the network, everything seems to be OK...
And I get this error: 419 unknown status
Any idea?
Upvotes: 0
Views: 594
Reputation: 19
Sometimes there may be situations where on which we may want to have routes to exist without requiring the CSRF_TOKEN. We can simply add those URIs or routes in VerifyCsrfToken middleware's except array like this
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
class VerifyCsrfToken extends Middleware
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'stripe/*',
'http://example.com/foo/bar',
'http://example.com/foo/*',
];
}
Upvotes: 1