Zend_File_Transfer – uploading same file multiple times

I faced with such problem: had one upload field for one file in my Zend_Form, and few checkboxes for choosing file destination. After form is submitted, this one file should be uploaded to each locations checked in form. So first idea was to loop through checked checkboxes, in each iteration set:

then do:

and it should be done, but its not. Problem is in

which is called BEFORE loop, and which can’t be modified INSIDE loop. After each receive() file is marked as already received and is not processed again. My solution was not state-of-art but works: files are received BEFORE checkbox loop, added to array, then loop is done and each file is copied where it should be. It looks this way:

 

2 comments

Leave a Reply