The 'receive()' method will return 'true' for file elements that are not required. The logic behind this is the following "the file can be omitted, and that's ok for me". The 'receive()' method will return false only in the event of a failure.
Still there are several ways to detect if a file has been uploaded or not:
- Use the function 'isUploaded' which returns a boolean
- Use 'getFileName' which returns null in this case (note that you must use the latest release for this behaviour)
- Use 'getFileInfo' which will have an empty 'file' key and the flag 'isUploaded' set to false
Posted in: Zend