How can I download/upload images in a REST API?
10,878
API uploads or downloads are done the same way whether you have a web application or a web service. You must use a multipart/form-data
in a POST request for uploads, and send the proper response headers in downloads. In short, the PHP manual on file uploads and say, readfile
for downloads, still applies for APIs.
Author by
KeyStroke
Updated on June 04, 2022Comments
-
KeyStroke almost 2 years
I'm about to code my first API for my codeigniter application (Using the popular REST library), but I couldn't find a way to let users upload and download my application's images through the API. How is it usually done in API's?
I appreciate your help. :)
-
Ruwantha over 11 yearsThis is really impotent. Could you please give us an example code.