I have a single Zend_Form_Element_File element that handles the upload just fine. What I want to know is, is it possible to use the Zend_Form_Element_File element only and still maintain the value that was originally uploaded? Generally this sort of thing would be handled via a hidden field but I would like to keep it in the Zend_Form_Element_File element itself.
So, how I'd like to do it:
- Select a file (foo.txt)
- Upload the file with the destination hardcoded
- Store the filename in the database
- Reload the file but pre-fill the file element (?) with the stored value in the database (foo.txt)
- Pass that value back in when submitted (or read a newly submitted value (bar.txt)
I've tried overriding the setValue() method (grasping at straws), adding a custom decorator that put a hidden element alongside the file element, and nixing all of the other decorators and basically changing the field to a hidden field.
I've not super good luck with any because of frustration with the constraints.
So, is it possible to do something like this? What is the best way to do this (aside from toggling between either having a file element or having an empty element)?
Thank you.