php - 我想使用 Zend 框架 2 在同一表单上的 2 个不同路径上上传 2 个文件
问题描述
我的代码如下。只有第二个文件(shareholder1)正在上传,第一个文件没有上传。问题出在 AddFilter..
$upload = new Zend_File_Transfer();
$company_name = $post['idcmpname'];
$douments_path = realpath('companydocuments');
$current_yr = date("Y");
$yr8 = 2018;
$company_name = str_replace(' ', '_', $company_name);
$path_memorandum = $douments_path . '/' . $company_name . '/' . 'memorandum' . '/' . $current_yr;
if (!is_dir($path_memorandum)) {
mkdir($path_memorandum, 0777, true);
}
$path_shareholder1 = $douments_path . '/' . $company_name . '/' . 'shareholder/' . $yr8;
if (!is_dir($path_shareholder1)) {
mkdir($path_shareholder1, 0777, true);
$filename_memorandum = str_replace(' ', '_', $files['memorandum1']['name']);
$tmpName = $files['memorandum1']['tmp_name'];
$filename_shareholder1 = str_replace(' ', '_', $files['shareholders1']['name']);
$tmpName = $files['shareholders1']['tmp_name'];
$upload->addValidator('Size', false, array('max' => '10MB', 'bytestring' => false));
$upload->addValidator('Extension', false, array('jpeg', 'jpg', 'png', 'pdf', 'txt', 'xls', 'xlsx', 'ppt', 'doc', 'docx', 'rtf'));
if ($upload->isValid()) {
$upload->addFilter('Rename', $douments_path . '/' . $company_name . '/' . 'memorandum' . '/' . $current_yr . '/' . $filename_memorandum, 'memorandum1')
->addFilter('Rename', $douments_path . '/' . $company_name . '/' . 'shareholder/' . $yr8 . '/' . $filename_shareholder1, 'shareholders1');
}
}
问题出在 AddFilter 中。我是 ZF 的新手
解决方案
推荐阅读
- msbuild - MSBuild 是否支持 .Net Core 项目
- jquery - 将评论添加到它所属的评论列表中
- android - Zbar 没有释放相机(kitkat 上的问题)android
- javascript - 将值分配给单个数组项并调用它们
- python - 根据最内层维度的某个特定索引处的值将张量掩码为 0
- visual-studio-2015 - 无法保存 TFS 构建
- python - pem 文件 base64 内容最后如何填充?
- python - 模型用户实例化错误
- python - 返回查询集对象时出现错误:无法解析表达式类型,未知的输出字段
- sql - Oracle查询聚合函数