Upload files with filepond.js and laravel 8

Tram Ho

With filepond.js is a pretty great image uploading library and the documentation about it is also quite a lot. There are also quite a few video tutorials combined with laravel, but I see no one instructing how to upload in encode format when we use submit form.

Here I will guide you in detail:

  1. In your HTML code, create a form to send a POST request to the submit_form route:

and register for more endcode plugins

  1. In the backend

Create routes:

Create controller:

In it, we use the json_decode function to convert the JSON string to an array in PHP, then decode the files using the base64_decode method. Finally, we save the decrypted files to disk using the put method of the Storage object.

Share the news now

Source : Viblo