/* 上传图片 */ function _upload_image($store_id) { import('uploader.lib'); //载入文件上传库 $uploader = new Uploader(); $uploader->allowed_type(IMAGE_FILE_TYPE); //配置允许的类型 $uploader->allowed_size(SIZE_STORE_CERT); // 400KB 配置文件大小 $data = array(); for ($i = 1; $i <= 3; $i++) { $file = $_FILES['image_' . $i]; if ($file['error'] == UPLOAD_ERR_OK) { if (empty($file)) { continue; } $uploader->addFile($file); //添加文件 if (!$uploader->file_info()) { $this->_error($uploader->get_error()); return false; } $uploader->root_dir(ROOT_PATH); $dirname = 'data/files/mall/application'; $filename = 'store_' . $store_id . '_' . $i; 构建文件名 $data['image_' . $i] = $uploader->save($dirname, $filename); 文件上传 } } return $data; }