PHP Techniques: Working with Files and Directories
2h 9mIntermediate2021-03-01
Authors

Kevin Skoglund
Founder of NovaFabrica
Course details
Having the knowledge for effectively working with files and directories is important for any programmer looking to go beyond the basics of PHP. With this course, Kevin Skoglund covers the important file skills for any PHP developer to have. He shows how to read from files, write to files, search directories, change permissions, and create forms so that remote users can upload files. He also shares some of his best practices and illustrates his lessons through code challenges you can follow along with, or just sit back and watch. After viewing Kevin’s course, you’ll be able to apply your new skills to your own projects.
Skills covered
PHPProgramming LanguagesOpen SourceSoftware DevelopmentOne-Off
Concepts
0. Introduction
- 01 - Work with files and directories in PHP
- 02 - Using the exercise files on GitHub
1. Working with Files
- 03 - Filesystem basics
- 04 - Relative paths and magic constants
- 05 - Accessing files
- 06 - Reading from files
- 07 - Reading line by line
- 08 - File permissions
- 09 - Writing to files
- 10 - Writing line returns
- 11 - Deleting files
- 12 - Moving the file pointer
- 13 - Examining file details
- 14 - Challenge - Create a log file
- 15 - Solution - Create a log file
2. Working with Directories
- 16 - Directory basics
- 17 - Creating and deleting directories
- 18 - Accessing directory contents
- 19 - Skipping directory entries
- 20 - Pattern matching with glob
- 21 - Challenge - Directory treasure hunt
- 22 - Solution - Directory treasure hunt
3. Accepting User-Uploaded Files
- 23 - Configuring PHP for file uploads
- 24 - Sending files as form data
- 25 - Inspecting uploaded files
- 26 - Moving uploaded files
- 27 - Handling upload errors
- 28 - Setting file permissions
- 29 - Securing file uploads
- 30 - Challenge - Profile photo
- 31 - Solution - Profile photos
Conclusion
- 32 - Next steps