I'm trying to use FilePond to upload profile picture during user registration on a Laravel 6 project.
In my register.blade.php I've a <input type="file" id="profilePicture" name="profile_picture" accept="image/png, image/jpeg, image/gif"> then, at the botton of the file I wrote:
$('input[type="file"]').filepond();
FilePond.setOptions({
server: {
url: '/upload',
method: 'POST',
headers: {
'X-CSRF-TOKEN': '{{ csrf_token() }}'
}
}
});
in /routes/web.php I added:
Route::post('/upload', 'FilepondController@upload');
and finally, for simplicity and only to check if the upload worked, in /app/Http/Controllers/FilepondController.php I wrote:
class FilepondController extends BaseController
{
public function upload(Request $request)
{
dd($request);
}
}
but never the app dump $request and die... Obviously the upload via FilePont fail.
I tried to use Sopamo/laravel-filepond (Laravel FilePond Backend) too without success...
What's wrong?
You may use the putFile method on the Storage facade
You may also use the storage:link Artisan command: