作者 邓超

上传文件

... ... @@ -367,13 +367,13 @@ class Home extends Base {
'cc|'.__('to_cc') => [$yzemail],
'bcc|'.__('to_bcc') => [$yzemail],
'priority|'.__('priority_email') => ['in'=>[1,3,5]],
'attachment|'.__('files_email') => [
'file'=>[
'ext' => [],
'size' => 1024*1024*50,
'mine' => []
]
],
// 'attachment|'.__('files_email') => [
// 'file'=>[
// 'ext' => [],
// 'size' => 1024*1024*50,
// 'mine' => []
// ]
// ],
'receipt|'.__('receipt_email') => []
],[
... ... @@ -414,6 +414,7 @@ class Home extends Base {
$sendData['reply_to'] = [];//回复到那个邮件
//Attachments 附件 上传的
$sendData['attachment'] = [];
// 这个是直接上传文件
$attachment = app()->file('attachment');
if($attachment){
foreach ($attachment as $file){
... ... @@ -429,6 +430,23 @@ class Home extends Base {
}
}
}
// 这个是通过了上传接口上传的文件
$attachment = app()->request('attachment');
if($attachment){
foreach ($attachment as $file){
$file = json_decode($file,true);
if(empty($file['data']['saveName'])|| !is_file(PUBLIC_PATH.$file['data']['saveName'])){
app()->e('附件('.$file['data']['name'].")异常");
}
$sendData['attachment'][] = [
'name' => $file['data']['name'],
'filename' => $file['data']['name'],
'signName' => $file['data']['saveName'],
'path' => PUBLIC_PATH.$file['data']['saveName']
];
}
}
// 远程路径,云文件
$attachmentUrl = app()->request('attachmentUrl');
if(is_array($attachmentUrl)){
... ...