SUBSCRIBE VIA RSS


Subscribe to our feed

Symfony Experts

Symfony Experts
If you have an urgent question for a symfony-related issue, this is the place to ask.

Topics

TWITTER

Stack Overflow


The old fashioned way

RECENT TUNES

  Archive for January, 2009

January 23, 2009 – 4:42pm Uploading a file with Symfony 1.2

There is a post hidden within the symfony documentation that discusses how to upload a file using the new forms framework within symfony 1.2. If you are curious about the best way to handle file uploads, it’s worth reading this What’s New in Symfony 1.2 post first, and then come back here for a quick summary of how this works.

Let’s say you would like to allow users to upload PDF files to your site. You store data related to these file uploads in an “article” table in your database. This table has a column named “file” that stores the file name of the uploaded pdf.

The symfony forms framework will generate the basic (and not so basic) code to get you started. If you haven’t yet generated your form classes yet, you can do so with the command:

More…