ZF-4260: If zend_form_element_file is validated, and whole form isnt, the file is still uploaded to the dir

Issue Type: Bug Created: 2008-09-12T01:58:06.000+0000 Last Updated: 2008-11-13T14:10:17.000+0000 Status: Resolved Fix version(s): - 1.7.0 (17/Nov/08)

Reporter: Marcin Lulek (ergo14) Assignee: Thomas Weidner (thomas) Tags: - Zend_Form

Related issues: - ZF-4062



Like in topic,

when we have a form with some validators, and the form doesnt validate, but file element validates, we end up with file being uploaded to the target dir, this is not expected behaviour, it leads to "orphaned" files if someone forgets to delete the file explictly.


Posted by Matthew Weier O'Phinney (matthew) on 2008-09-12T05:42:00.000+0000

ZF-4062 is the real issue here.

First off, the file upload will happen regardless of what we do; for us to get the request in the first place, the file has to have been transferred in the request. By default, however, files are uploaded to a system temporary directory (this is something PHP does, not ZF). It is up to you to run garbage collection over that directory periodically.

However, there is an additional piece of the puzzle we need to address. One of the validators actually does introspection over the $_FILES superglobal; a file element is not considered valid unless the entry for the file in $_FILES shows no errors. However, at this time, if that validator passes, then the file is transferred to its final resting place.

Thomas is working on decoupling the validation from the filtering withing Zend_File_Transfer and the File form element, and we will have a solution soon

Posted by Matthew Weier O'Phinney (matthew) on 2008-09-12T05:42:27.000+0000

Assigning to Thomas (close with ZF-4062)

Posted by Thomas Weidner (thomas) on 2008-09-13T14:54:15.000+0000

No bug. New feature has been implemented with r11391.

Posted by Wil Sinclair (wil) on 2008-11-13T14:10:17.000+0000

Changing issues in preparation for the 1.7.0 release.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.