I am trying to upload multiple files to my web server, but am having problems trying to check if each of the elements in the array have a file uploaded to them.
Here's the HTML I use to create the form:
Code: Select all
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Upload Images: <input type="file" name="uploaded_files[]">
<input type="file" name="uploaded_files[]">
...etc.And here's the code I'm using to try and check the keys in the $_FILES array at the moment (this is part of a function called "is_empty( ) and returns true if the array is empty, or false if it is NOT empty):
Code: Select all
if($this->data_type=="image_file")
{
if(!empty($_FILES))
{
foreach($_FILES[$this->field_name] as $key => $name)
{
if(!empty($_FILES[$this->field_name]["name"][$key]))
{
return false; //Returns false if the field has a file selected to be uploaded
}
else return true; //Returns true if no file has been selected to be uploaded
}
}
else return true;
}Thanks.