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 applicatio开发者_JAVA技巧n's images through the API. How is it usually done in API's?
I appreciate your help. :)
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.
精彩评论