ctwx's avatar
Level 1

What is the best way to save photos/images?

I am developing an app with Laravel and VueJS. The Laravel backend only returns JSON. VueJS uses axios to get, post, delete etc.

I have a model "Cat" which has 29 attributes. One of them is a photo of them. I don't know how big the images will be.

Now I am plan to implement a photo upload. I have a create form which creates new Cat objects in the system.

I am not sure what is the best way to realize it. I was thinking to base64 encode the image and post it the the server withing the other data. Then is the question: how to save it? In the database as blob, or on the server as a file? Another idea is to create a post request that simply saves the image. Then I must make sure to add the right data so the backend identifies it as a file.

Do you have any suggestions?

0 likes
1 reply

Please or to participate in this conversation.