How can I detect if an optional file has been uploaded?

Answer

The receive() method will return true for file
elements that are not required. The reason is that you said "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 isUploaded which returns a boolean
Use getFileName which returns null in this case (note test release)
Use getFileInfo which will have an empty 'file' key and the flag 'isUploaded' set to false

All zend Framework 2 Questions

Ask your interview questions on zend-framework-2

Write Your comment or Questions if you want the answers on zend-framework-2 from zend-framework-2 Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---