我搜索过上传多个文件,但这些文件与此不同。这个文件要上传单个文件,但数组值不同。
<form method="post" action="<?php echo $this->url(array('controller'=>'practice','action'=>'save-multiple-img'),'azend');?>" enctype="multipart/form-data">
<input name="name" type="text" />
<input name="file['f_plan'][1][]" id="file" type="file" />
<input name="file['f_plan'][1][]" id="file" type="file" />
<input name="file['f_plan'][1][]" id="file" type="file" />
<input name="file['f_plan'][2][]" id="file" type="file" />
<input name="file['f_plan'][2][]" id="file" type="file" />
<input name="file['f_plan'][3][]" id="file" type="file" />
<input name="file['f_plan'][3][]" id="file" type="file" />
<input type="submit" name="upload_images" value="Upload Images">
</form>
在我的控制器中
$apt = new Zend_File_Transfer();
$files = $apt->getFileInfo();
$post = $this->getRequest()->getPost();
//$filterChain = new Zend_Filter();//print_r($_FILES['file']);die();
foreach($_FILES['file']['name'] as $key => $tmp_name){
foreach($tmp_name as $k => $value) {
$apt->setDestination('images/practice/thumbs');
$apt->addFilter('Rename', array('target' =>$post['name'],'overwrite' => true,'cropToFit'=>true));
if ($apt->receive()) {
}
else{
echo 'not uploaded<br>';die();
}
}
}
在上传文件时,我会收到像
这样的警告Warning: file_exists() expects parameter 1 to be a valid path, array given in C:\xampp\htdocs\azend\library\Zend\File\Transfer\Adapter\Abstract.php on line 1283
Array to string conversion in C:\xampp\htdocs\azend\library\Zend\Validate\Abstract.php on line 233
请帮帮我如何上传这些类型的文件!!在此先感谢