开发者

Get name of first file in files[] array

开发者 https://www.devze.com 2023-04-04 00:17 出处:网络
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\'][\

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']);
0

精彩评论

暂无评论...
验证码 换一张
取 消