problem of validation in form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shinstar
Forum Newbie
Posts: 18
Joined: Fri May 21, 2010 2:33 pm

problem of validation in form

Post by shinstar »

can any one tell me how can i validate this line if i use it in form to upload file,

Code: Select all

<input type="file" name="images[]" class="wwIconified" value="upload"/><br />
i want the validation above code like in php but i dont understand ho can i do it

Code: Select all

if ( !upload )

{
error ="You must upload picture file";
}
i just want that user must upload a file that is been specified my me e.g in .jpg , .png format...
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: problem of validation in form

Post by Celauran »

Code: Select all

if (!isset($_FILES['images']))
{
    // whatever
}
Post Reply