Ok, so I went with my plan B and echo the allowed file types to the dom to
share for validating with JS.
New question: *I think* I need to access an existing form instance that was
created by an index. The trick is that I need another controller to be able to
access it when parsing it through a web service.
example:
indexAction(){
$this->view->form = new Projects_Form_NewFile2();
}
serviceAction(){
$form = how_do_i_get_index_form()?
}
The reason I need this exact instance (afaik) is because I'm generating random
csrf token for each new Form instance (cross-site-script security) but my web
service allows the user to submit the same form several times without
recreating it.
I looked through view helpers but couldn't find a way to access forms from the
view by the Controller.
OR, should I return a new tokenized form through the web service after each
submit?
I appreciate any insight into this. Thanks!
-Wilson
-----Original Message-----
From: Wilson Revehl (Go Media Inc.) [mailto:[email protected]]
Sent: Thursday, January 19, 2012 11:04 AM
To: Zend Framework ([email protected])
Subject: [fw-general] pre-validating files in Zend_File_Transfer
Hello ZF'ers. I'm digging the simplicity of Zend_File_Transfer but ran into
something I'm not quite sure how to tackle. I want to avoid having extension
and mime exceptions in both javascript and php so I'm hoping to keep file
validation on the server. But I don't want users to have to wait for their
whole file to upload only to find out they weren't allowed to upload that file
type in the first place. It seems like the receive() method mainly serves the
purpose of accepting the file into the setDirectory. But that the file is still
uploaded into temporary space.
Is it possible for me to use the lovely File_Transfer validators in conjunction
with a function to stop the files in their tracks if they fail? I want to make
this as resource efficient as possible for both the client and the server.
Thank you very much for any insight on this!
Also, are there any handy chunking/streaming options I'm not seeing?
-Wilson
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]