[symfony-users] Re: Upload file name

2009-04-01 Thread Campezzi
Glad I could help! Rock on :) On Mar 31, 12:04 pm, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: Campezzi, thanks a lot! This indeed works! I did the Jobeet tutorial, but oviously I read over it.         public function generateFileFilename(){                 return

[symfony-users] Re: Upload file name

2009-03-31 Thread Campezzi
I didn't test this, but I remember seeing something like that in the Jobeet tutorial: If a generateLogoFilename() method exists in the model, it will be called by the validator and the result will override the default generated logo filename. The method is given the sfValidatedFile object as an

[symfony-users] Re: Upload file name

2009-03-31 Thread HAUSa
Campezzi, thanks a lot! This indeed works! I did the Jobeet tutorial, but oviously I read over it. public function generateFileFilename(){ return 'testnow.pdf'; } My file has a neat testnow.pdf file name on upload. On 31 mrt, 15:05, Campezzi

[symfony-users] Re: Upload file name

2009-03-30 Thread Fási Gábor
It's pretty useful when you have two files with the same name uploaded. You can get the original filename via sfValidatedFile-getOriginalName() An instance of sfValidatedFile is returned by sfValidatorFile by default. On Mon, Mar 30, 2009 at 11:51, HAUSa

[symfony-users] Re: Upload file name

2009-03-30 Thread HAUSa
Thx for your reply Joan! I do understand your explaination op the sfValidatedFile class. But, how do I overwrite / extend the sfValidatedFile? Should I create a class in my lib directory? And how do I overwrite the file name? I searched the Symfony website, but I cannot find any information

[symfony-users] Re: Upload file name

2009-03-30 Thread Tomasz Ignatiuk
$form-bind($request-getParameter($form-getName()), $request- getFiles($form-getName())); if ($form-isValid()) { $file = $this-form-getValue('your_file_fieldname'); if(!is_null($file)) { $filename = $file-getOriginalName()

[symfony-users] Re: Upload file name

2009-03-30 Thread HAUSa
Fási, thank you too! But I do not understand about sfValidatedFile- getOriginalName(). I'm working in my form class, in sfValidatorFile. I cannot use those functions there. On 30 mrt, 12:43, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: Thx for your reply Joan! I do understand your

[symfony-users] Re: Upload file name

2009-03-30 Thread FÁSI Gábor
While saving the form data in your action, you can get the sfValidatedFile instance by calling $form[file]-getValue(), and that has the getOriginalName() method I was referring to. On Mon, Mar 30, 2009 at 12:46, HAUSa jeroen_heeft_behoefte_aan_r...@hotmail.com wrote: Fási, thank you too! But I

[symfony-users] Re: Upload file name

2009-03-30 Thread Joan Teixidó
Hi, when the sfValidatorFile clean the file, it's convert to instance of sfValidatedFile. This class makes the save and md5 of the file. You can create a new class to manage a validated file, and pass the name of this class to the sfValidatorFile (it's the option: validated_file_class.) What i do

[symfony-users] Re: Upload file name

2009-03-30 Thread Joan Teixidó
hi, the solution of Tomasz maybe more easy than creating a new class. Here (http://www.symfony-project.org/api/1_2/sfValidatedFile) you can find the documentation and the methods getOriginalName and others. Joan 2009/3/30 Tomasz Ignatiuk tomek.ignat...@gmail.com