开发者

How to get second file during upload with Zend Framework

开发者 https://www.devze.com 2023-01-23 15:35 出处:网络
I have 2 file controls on the form - one for logo and one for big ima开发者_如何学JAVAge and this code didn\'t work

I have 2 file controls on the form - one for logo and one for big ima开发者_如何学JAVAge and

this code didn't work

$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Count', false, array('min' =>0, 'max' => 2));

$files = $upload->getFileInfo();            

foreach ($files as $file => $info) 
{
    if($upload->isValid($file)){ .. do receive ..}
}

and this code works well

$upload = new Zend_File_Transfer_Adapter_Http();
$upload->addValidator('Count', false, array('min' =>0, 'max' => 2));

$files = $upload->getFileInfo();            

foreach ($files as $file => $info) 
{
    if(!empty($info['name'])){ .. do receive ..}
}

when I upload file only for the second file

why is it so?


foreach ( $upload->getFileInfo() as $file )
{
   ... play with validation and receive here ...
}
0

精彩评论

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

关注公众号