Categories
symfony

Upload image in admin generator

Are you thinking of adding user photo to his profile or so. Admin generator allows very usefull feature which provides uploading/viewing of uploaded image. But you should be carefull. It’s not the same for different Symfony versions. I had to browse through forum threads before I’ve found out correct answer.

For instance, lets add this code into generator.yml code:

[php]
photo:
name: Photo
type: admin_input_file_tag
upload_dir: dyn/magasins
params:
include_link:dyn/magasins
include_remove:true
include_text: AAA
include_remove_text:BBB
[/php]

Unfortunately, this won’t work for stable version 0.6.3

You should use object_admin_input_upload_tag() for 0.6.3 and earlier versions.
If you use 0.7 and newer versions – object_admin_input_file_tag will work fine.

Leave a Reply

Your email address will not be published. Required fields are marked *