Reputation: 1485
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. :)
Upvotes: 2
Views: 11354
Reputation: 67735
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.
Upvotes: 2