Streams and large files

So far, our web service can perform the basic operations on a user profile. In this chapter, we will extend the user profile service to also handle a user's profile image. During the course of this chapter, you will learn how you can process even very large files using PHP streams.

Profile image upload

Basically, in a RESTful application, you can treat an image just as any other resource. You can create and update it using POST and/or PUT operations, and you can retrieve it using GET. The only difference is the chosen representation of the resource. Instead of JSON encoding using application/json as a Content-Type, you will now work with resources that have a JPEG or PNG representation, with their respective image/jpeg or ...

Get PHP 7 Programming Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.