Development Blog With Code Updates : Developercast.com

March 12, 2010

Ian Christian’s Blog: Handling Uploaded file in symfony’s admin generator

Filed under: Development — @ 12:03 pm

Ian Christian has an informative new post for the Symfony developers out there. He’s figured out a way to handle uploaded files with Symfony’s admin generator relatively easily, changing the filename option.

When a file is uploaded using sfForm in the admin generator, by default the filename that’s used is a random string, which can look bad in URLs. If you want to change this, it’s not immediately obvious how – but it is incredibly simple.

The Symfony project does have some documentation on the topic, but it’s not the easiest to read. It basically boils down to is defining a function in your extended class based on the name of the file where you can change the name however you’d like. Code snippets are included to make the point a bit more clear.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress