Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tayyabshahzad1's avatar

How to Check if request have file

How can I check if request has any file.

$request->hasFile() need one parameter that is file name that we have in form,, but i am checking only if request have file or not.

Please Help

0 likes
6 replies
tykus's avatar

The parameter is the name of the input, not the filename

tayyabshahzad1's avatar

Yes my bad its a name of input but in my case i don't know is there any input type file field is available in HTML form or not. I want to check if form has file or not.

Please or to participate in this conversation.