This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace App\Controllers\board;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\MyUpload;
|
||||
use App\Models\board\NoticeModel;
|
||||
|
||||
class Notice extends BaseController
|
||||
@@ -108,7 +109,7 @@ class Notice extends BaseController
|
||||
// 공지사항 작성
|
||||
public function actWrite()
|
||||
{
|
||||
|
||||
$lib = new MyUpload();
|
||||
|
||||
try {
|
||||
|
||||
@@ -125,6 +126,37 @@ class Notice extends BaseController
|
||||
$file = $this->request->getFile('file');
|
||||
|
||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||
|
||||
$uploadPath = "/upload/notice/" . date('Ymd') . "/";
|
||||
|
||||
$arrUploadfile = [];
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||
|
||||
if ($uploadData !== false) {
|
||||
$arrUploadfile[] = $uploadData;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrUploadfile)) {
|
||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||
$data['file'] = [
|
||||
'file_sq' => $this->request->getPost('file_sq'),
|
||||
'orig_name' => $uploadFile['origin_name'],
|
||||
'new_name' => $uploadFile['file_name'],
|
||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||
'ext' => '.' . $uploadFile['ext'],
|
||||
'size' => $file->getSize(),
|
||||
'img_yn' => null,
|
||||
// 높이/폭은 나중에 getimagesize 등으로 구해도 됨
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
$origName = $file->getClientName();
|
||||
$ext = $file->getClientExtension();
|
||||
$size = $file->getSize();
|
||||
@@ -154,6 +186,8 @@ class Notice extends BaseController
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
];
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +235,8 @@ class Notice extends BaseController
|
||||
// 공지사항 수정요청
|
||||
public function actModify()
|
||||
{
|
||||
$lib = new MyUpload();
|
||||
|
||||
try {
|
||||
|
||||
$data = [
|
||||
@@ -216,6 +252,36 @@ class Notice extends BaseController
|
||||
$file = $this->request->getFile('file');
|
||||
|
||||
if ($file && $file->isValid() && !$file->hasMoved()) {
|
||||
$uploadPath = "/upload/notice/" . date('Ymd') . "/";
|
||||
|
||||
$arrUploadfile = [];
|
||||
if ($file->isValid() && !$file->hasMoved()) {
|
||||
$uploadData = $lib->do_upload2($file, $uploadPath);
|
||||
|
||||
if ($uploadData !== false) {
|
||||
$arrUploadfile[] = $uploadData;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrUploadfile)) {
|
||||
foreach ($arrUploadfile as $key => $uploadFile) {
|
||||
$data['file'] = [
|
||||
'file_sq' => $this->request->getPost('file_sq'),
|
||||
'orig_name' => $uploadFile['origin_name'],
|
||||
'new_name' => $uploadFile['file_name'],
|
||||
'file_path' => $uploadPath, // 필요에 따라 상대경로로만 저장
|
||||
'ext' => '.' . $uploadFile['ext'],
|
||||
'size' => $file->getSize(),
|
||||
'img_yn' => null,
|
||||
// 높이/폭은 나중에 getimagesize 등으로 구해도 됨
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
$origName = $file->getClientName();
|
||||
$ext = $file->getClientExtension();
|
||||
$size = $file->getSize();
|
||||
@@ -247,6 +313,8 @@ class Notice extends BaseController
|
||||
'img_height' => null,
|
||||
'img_width' => null,
|
||||
];
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user