From: Jim Lucas on
te0t3l wrote:
> Hi, I need to validate a field that work with Multifile plugin of Jquery,
> I want to check if the field is empty with php.
>
> [code]
> <input name="archivo[]" class="multi" type="file" accept="gif|jpg|png"/>
> <input name="button" type="submit" value="Submit">
> [code]
>
> I've tried different ways but it does not work:
> for example:
> $field = $_FILES["archivo"]["name"];
> $field = $_FILES["archivo[]"]["name"];
>
> i dont know how to validate it, any help would be appreciated.
>
> Thanks,
>

To see what is happening, look at the output of print_r($_FILES);

But, you should be doing it like this.

foreach ( $_FILES["archivo"] AS $file ) {
$field = $file['name'];
...
}


--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
From: te0t3l on
It works fine for me,

foreach ( $_FILES['archivo']['name'] as $file ) {
//echo $file;
}
if($file == ""){
echo "empty";
}else{
//continue...
}

Thanks a lot Jim!

Te0