is_uploaded_file with multiple uploads?

I have one page, there is a uploadimage and a uploadvideo.
When there is only a uploadimagem I can use is_uploaded_file($_FILES[‘upload’][‘tmp_name’] to check if there is a file uploaded. But When there are more than one file upload at same time, How can I check if the video is uploaded. BTW, I assume the names of the image and video are unknown.

First the input name needs to be an array.

<input type="file" name="upload[]" multiple />

You can then use WHILE. LIST, EACH to loop through this array and use $key to identify each array. For example.

<?php
while(list($key,$value) = each($_FILES['upload']['name'])){
/*
You would then use the $key to grab specific array values e.g.
$_FILES['upload']['error'][$key]
$_FILES['upload']['tmp_name'][$key]
etc
*/
?>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.