我在使用 php zend 框架上传多个文件时遇到问题
我有一个包含许多 input[type="file"] 标签的表单,每个标签都有其唯一的名称和 id 属性。
当接收到这些数据时,所有文件都聚集在一个数组文件中,我现在可以轻松地接收和存储它,但这里的问题是我如何识别哪个文件来自哪个输入元素?知道这一点对我来说非常重要,因为每个特定文件都将存储在我数据库的特定字段中。
这是一个例子
<input type "file" name = "main_photo"/>
<input type "file" name = "horizontal_plan"/>
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
foreach ($files as $file => $info)
{
if($upload->isValid($file))
{
//here how can i point to the main_photo file or the horizontal_plan file?
}
}
请帮忙,提前谢谢你。