开发者

How can I download/upload images in a REST API?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜