Get name of first file in files[] array
I have an array of files posted with name="files[]"
an开发者_开发百科d id like to take the name of the first file and assign it the variable $first_file
. When i do $first_file = $_FILES['files']['name'];
it just returns 'array'.
Easy:
$_FILES['files']['name'][0];
Try
$_FILES['files']['name'][0];
You can use
$_FILES['files']['name'][0]
By the way, If you want to see all the keys you can do
print_r($_FILES['files']['name']);
精彩评论