Home > Enterprise >  What is best way to send images to Rest API?
What is best way to send images to Rest API?

Time:12-17

I am trying to build a React app which sends an image to an Rest API and returns a processed image. What is the best way to send images through Rest API ? My current assumption is using "base64" encoding to send images as strings,but the size of my images will be around 5-10MB and I dont think base64 will cut it.

Please help me out here,I am build the front-end using ReactJS & NodeJs,the Rest API will be build using python Flask or FastAPI.

CodePudding user response:

You shouldn't be sending the images this way at all. The rough approach might be to upload images to some storage (S3 or whatever), then use API just to communicate the reference to that image (id, URI). Basically, you just need to send the info about who uploaded the image (user id) and where it is stored (filesystem path of the image, S3 reference, etc.), then you'll be able to relate the two entities and handle the images processing separately.

CodePudding user response:

If file size is greater then you can use FineUploader, using fineuploader file can upload in chunks.

  • Related