Chris
Chris

Reputation: 1129

PHP Check if someone chose a file

Can someone show me some example code on how i would check to see if someone picked a file in the file input field as i only want to display a message if they have.

Cheers,

Upvotes: 1

Views: 121

Answers (1)

Breezer
Breezer

Reputation: 10490

well if you want it to do it while they were using the form you would need to use javascript you can see it be done here

how to check if a file is selected using javascript?

you want a php solution one way can also bee seen in the same topic

this is for multiply files

foreach($_FILES['item']['size'] as $k=>$v){
    if($v>0)
         //Do something
}

try that

Upvotes: 1

Related Questions