2009年3月28日星期六

Re: [fw-mvc] form->getValues and file upload

> Yes, you misunderstood completly.
>
> When you want to "GET" the content of a file element you will of course get
> the file itself which means that it's being uploaded.
>
> When you want to validate a element you should call isValid() and not
> getValues().

Yes Thomas I agree with you ...
infact I use
if($this->getRequest()->isPost()){
if ($form->isValid($this->_request->getPost())) {

and in this case no $form->getValues() is called
but I suppose he wants a workaround for $form->getValues()
preventing that the receive() method being called but I didnt understand why ...

> When you have to change the content you should apply file-filters... they
> were build just for this usecase.
> Only when the files are VALID you should call receive() or getValues().

yes but take a look to his code ...
> $id = $application->saveEntry($form->getValues());
> // use new id to process and save attached file...
> $upload = new Zend_File_Transfer();

that's the problem .. the file it's just processed during the getValues() call

Ed I think it's better if you start to consider this appoach
if($this->getRequest()->isPost()){
if ($form->isValid($this->_request->getPost())) {
$id = $application->saveEntry($this->_request->getPost());
$upload = new Zend_File_Transfer();

bye


--
________________________________________________________________________________

Simone Cosci - Planet S.r.l. Sistemi informatici
Via Giorgio Ambrosoli, 39 - 50018, Scandicci, Firenze, Italy
WEB: http://www.planetweb.it - http://www.ticka.it
E-Mail s.cosci@nextidea.it
Tel. +39 055 7350271 - Fax. +39 055 7351109
________________________________________________________________________________

没有评论: