Join Jon Peck for an in-depth discussion in this video Uploading files, part of Learning Symfony2 for PHP.
Well, if you feel like there hasn't been…enough coding in this course, buckle up.…Things are about to get real.…One of the helpful parts of HTTP foundation is uploaded file…which represents a file uploaded through a form.…We're going to be using uploaded file…in the issue entity to facilitate cover uploads.…Uploaded file comes with a number of helper methods…including move which takes a target…directory and optional name for file.…Move, as you probably guessed,…moves a file to a new location.…We'll also be using get client original name…to get the original file name of the uploaded file.…
Depending on your security or organizational needs,…it may makes sense to generate a file name instead.…We're going to be making a number…of changes necessary for uploading a file…but individually they're actually quiet straightforward.…Let's walk through them first to the high level.…We'll start with the issue entity and add methods…to get passed to our upload directories while the absolute…path on disk and the relative path for web operations.…
- Installing Symfony
- Creating a bundle from the console
- Customizing and generating database tables
- Generating controllers
- Creating, editing, and debugging entities
- Displaying and debugging a form
- Rendering content with templates
Skill Level Intermediate
Q: When trying to access the application, I receive an error stating "This script is only accessible from localhost." How can I get around this restriction?
A: The development front controller and configuration scripts are protected by default to only allow access from the localhost. Refer to the video titled “Exploring the Symfony layout” to see how to disable this security.