开发者

How can I know a number of uploaded files with PHP? [duplicate]

This question already has answers here: Closed 12 years ago.

Possible Duplicate:

How can I know a number of uploaded files with PHP?

Hello, I have a form with three

input type="file"

tags. How can I know on the server side amount of files uploaded by the user? He can upload 3 files, or may be 2 files, 1 or even nothing. I need to know how much files user have uploaded.

If I use the code

echo count($_FILES);

It will always display t开发者_如何学Pythonhe value of 3. Because form contains three file fields. If the user will upload only two files, the code will display 3, but the right value is 2.


try

$count=0;
foreach($_FILES as $file){
if ($file["size"]>'0')$count++;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜