In this video, Keith Casey demonstrates how to implement our design to upload and process images via our API.
- [Instructor] Now we need to figure out…how to upload a file.…First, let's create a place…for these incoming files.…In our Silex app,…we'll create a folder called Assets,…and then within that folder,…we'll create another one called Images.…So now any images we upload…we'll put right in this folder.…And now, we can use our standard PHP approach…for uploading files.…So we go down to the post messages path,…and we go ahead and start dealing with it here.…So we say new file equals,…use the normal files array,…we grab a parameter called file,…then we say upload file name equals new file,…and we get back the name of the file…that was actually uploaded.…
Now we wanna move this uploaded file…from the temp directory…where it gets uploaded by default,…and put it in our destination directory.…In this case, it's assets, images,…and then upload file name.…And now once we have that,…we'll create the image path,…and call that assets, images,…and again, upload file name.…And then down below,…we wanna make sure that on the message itself,…
This course begins with a simple application specification and builds it one step at a time. Each chapter includes a key concept, with examples from other public APIs, and then shows how to build it yourself with Silex. Learn about URL routing, validating input, and generating response codes and hypermedia payloads. Like any project, the first implementation may be a little messy, but don't worry. The last chapter covers refactoring and what it takes to scale and support the API going forward.
- Understanding the project goals
- Adding authentication with Silex
- Using cross-framework and authentication middleware
- Creating a read-write API in Silex
- Uploading files via an API
- Adding file security
- Creating payloads and response codes in Silex
- Scaling your API
Skill Level Beginner
PHP Date and Time Essential Trainingwith David Powers4h 31m Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
1. Project Explanation and Goals
2. Authentication Options and Tradeoffs
Cross framework middleware1m 32s
3. Create a Read-Write API
4. File Uploads via API
5. Scale Your API
Next steps1m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.