[symfony-users] file name changed after upload

2008-10-05 Thread julien

Hi,
I have generated an admin backend.
Some fields are type of admin_input_file_tag.
It works fine. Except that the file name is changed.
For instance, uploading fake_article.pdf becomes
1e0d5f6621b2a5a05dffdbfcd787ed31.pdf

Is it possible to keep the original file name?

Thanks,

Julien
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: file name changed after upload

2008-10-05 Thread julien meyer
Hello Julien,
The file name is changed since he's encoded via sha1() function (
http://fr2.php.net/manual/en/function.sha1.php) by default.

I think it's not recommended to keep the original file name (name conflict,
security...), but you can customise the filename via the generator.yml :

generator:
  class:sfPropelAdminGenerator
  param:
model_class:  Example
theme:default

edit:
  fields:
pdf:
  type:  admin_input_file_tag
  upload_dir:   pdf_files
  filename:  pdf_%%id%%
  params:include_link=user_pics include_remove=true


For the third record of your database, the filename will be pdf_3.pdf.

Take a look here :
http://www.symfony-project.org/forum/index.php/m/54777







2008/10/5 julien [EMAIL PROTECTED]


 Hi,
 I have generated an admin backend.
 Some fields are type of admin_input_file_tag.
 It works fine. Except that the file name is changed.
 For instance, uploading fake_article.pdf becomes
 1e0d5f6621b2a5a05dffdbfcd787ed31.pdf

 Is it possible to keep the original file name?

 Thanks,

 Julien
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony + smarty

2008-10-05 Thread Fabrice B

I used Smarty for a long time because I found the templates much more
redable. But from my experience the PHP code generated by Smarty from
the templates is quite ugly. And since I discovered the PHP script
version ie if(): endif; I find PHP code in the template quite
readable.

You can go even further, depending on your PHP settings, by using
short tags. ? ? instead of ?php ?. I personally don't because I
don't want to depend on the PHP settings of the server, but if you
really want smarty-like readability without adding another useless
layer, it is surely the best option. I would not recommend Smarty
anymore.

Cheers,

Fabrice




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re : [symfony-users] file name changed after upload

2008-10-05 Thread Loïc Vernet
You'll have to override the admin-gen save method of your module or to make 
your own admin generator theme.

++ COil



- Message d'origine 
De : julien [EMAIL PROTECTED]
À : symfony users symfony-users@googlegroups.com
Envoyé le : Dimanche, 5 Octobre 2008, 13h31mn 26s
Objet : [symfony-users] file name changed after upload


Hi,
I have generated an admin backend.
Some fields are type of admin_input_file_tag.
It works fine. Except that the file name is changed.
For instance, uploading fake_article.pdf becomes
1e0d5f6621b2a5a05dffdbfcd787ed31.pdf

Is it possible to keep the original file name?

Thanks,

Julien


  
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Symfony + smarty

2008-10-05 Thread Frank Stelzer

Hi,
same opinion from my side. We use smarty in the office and we are  
faced very often with smarty limitations which are very annoying.
Another thing is the lack of inheritance or customization  
possibilities of smarty.

Try to add a custom handler for the compiling which does not use the  
primary operations of a normal and local file system. Forget it!
They have a pretty good documentation, but i do not like the php4/php5  
code.

A very important point is, that symfony supports the main features of  
a template engine. So for example, why use an external template  
engine, which supports caching, when the framework does it for you?

However we have to use smarty, because it was the best template engine  
on the market. So, when external designers have to write smarty  
templates, it is a good choice. If the developers have to make the  
designers job, then forget smarty and use the raw symfony templates.

You will save a lot of time!

Cheers,
Frank


Am 05.10.2008 um 17:01 schrieb Fabrice B:


 I used Smarty for a long time because I found the templates much more
 redable. But from my experience the PHP code generated by Smarty from
 the templates is quite ugly. And since I discovered the PHP script
 version ie if(): endif; I find PHP code in the template quite
 readable.

 You can go even further, depending on your PHP settings, by using
 short tags. ? ? instead of ?php ?. I personally don't because I
 don't want to depend on the PHP settings of the server, but if you
 really want smarty-like readability without adding another useless
 layer, it is surely the best option. I would not recommend Smarty
 anymore.

 Cheers,

 Fabrice




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re: Re : [symfony-users] Re: file name changed after upload

2008-10-05 Thread julien

thanks for your answers.
I think I'll try to override the save, but I'm not quite sure how to
do it.
I've been in the source : /cache/my_app/dev/modules/automy_module/
actions/actions.class.php
It seems that two methods are actually used to save the form.
executeEdit() and updatePublicationsFromRequest()

In order to have my own naming system, do I have to create a method
called executeEdit and another one called
updatePublicationsFromRequest in /apps/my_app/modules/my_module/
actions/actions.class.php ? Then implement my own code in it?

thanks for your advices,

Julien

On 5 oct, 17:21, Loïc Vernet [EMAIL PROTECTED] wrote:
 Humm i didn't know (remember) that, thanks. It's great for a basic file 
 naming, but for an advanced one i think the save will have to be overridden.

 - Message d'origine 
 De : julien meyer [EMAIL PROTECTED]
 À : symfony-users@googlegroups.com
 Envoyé le : Dimanche, 5 Octobre 2008, 16h42mn 31s
 Objet : [symfony-users] Re: file name changed after upload

 Hello Julien,
 The file name is changed since he's encoded via sha1() function 
 (http://fr2.php.net/manual/en/function.sha1.php) by default.

 I think it's not recommended to keep the original file name (name conflict, 
 security...), but you can customise the filename via the generator.yml :

 generator:
   class:                    sfPropelAdminGenerator
   param:
     model_class:      Example
     theme:                default

     edit:
       fields:
         pdf:
           type:              admin_input_file_tag
           upload_dir:   pdf_files
           filename:      pdf_%%id%%
           params:        include_link=user_pics include_remove=true

 For the third record of your database, the filename will be pdf_3.pdf.

 Take a look here :http://www.symfony-project.org/forum/index.php/m/54777

 2008/10/5 julien [EMAIL PROTECTED]

 Hi,
 I have generated an admin backend.
 Some fields are type of admin_input_file_tag.
 It works fine. Except that the file name is changed.
 For instance, uploading fake_article.pdf becomes
 1e0d5f6621b2a5a05dffdbfcd787ed31.pdf

 Is it possible to keep the original file name?

 Thanks,

 Julien
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---



[symfony-users] Re : [symfony-users] Re: Re : [symfony-users] Re: file name changed after upload

2008-10-05 Thread Loïc Vernet
Absolutely.



- Message d'origine 
De : julien [EMAIL PROTECTED]
À : symfony users symfony-users@googlegroups.com
Envoyé le : Dimanche, 5 Octobre 2008, 22h27mn 35s
Objet : [symfony-users] Re: Re : [symfony-users] Re: file name changed after 
upload


thanks for your answers.
I think I'll try to override the save, but I'm not quite sure how to
do it.
I've been in the source : /cache/my_app/dev/modules/automy_module/
actions/actions.class.php
It seems that two methods are actually used to save the form.
executeEdit() and updatePublicationsFromRequest()

In order to have my own naming system, do I have to create a method
called executeEdit and another one called
updatePublicationsFromRequest in /apps/my_app/modules/my_module/
actions/actions.class.php ? Then implement my own code in it?

thanks for your advices,

Julien

On 5 oct, 17:21, Loïc Vernet [EMAIL PROTECTED] wrote:
 Humm i didn't know (remember) that, thanks. It's great for a basic file 
 naming, but for an advanced one i think the save will have to be overridden.

 - Message d'origine 
 De : julien meyer [EMAIL PROTECTED]
 À : symfony-users@googlegroups.com
 Envoyé le : Dimanche, 5 Octobre 2008, 16h42mn 31s
 Objet : [symfony-users] Re: file name changed after upload

 Hello Julien,
 The file name is changed since he's encoded via sha1() function 
 (http://fr2.php.net/manual/en/function.sha1.php) by default.

 I think it's not recommended to keep the original file name (name conflict, 
 security...), but you can customise the filename via the generator.yml :

 generator:
   class:sfPropelAdminGenerator
   param:
 model_class:  Example
 theme:default

 edit:
   fields:
 pdf:
   type:  admin_input_file_tag
   upload_dir:   pdf_files
   filename:  pdf_%%id%%
   params:include_link=user_pics include_remove=true

 For the third record of your database, the filename will be pdf_3.pdf.

 Take a look here :http://www.symfony-project.org/forum/index.php/m/54777

 2008/10/5 julien [EMAIL PROTECTED]

 Hi,
 I have generated an admin backend.
 Some fields are type of admin_input_file_tag.
 It works fine. Except that the file name is changed.
 For instance, uploading fake_article.pdf becomes
 1e0d5f6621b2a5a05dffdbfcd787ed31.pdf

 Is it possible to keep the original file name?

 Thanks,

 Julien


  
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~--~~~~--~~--~--~---