Open Dejmienwp opened 2 years ago
Why this is not working ? I wanna upload img summernote on folder where is ID - POST ...
I will try $id, $rows['id'] - always i have code " /169160a0-693f-489c-b5cb-0b979cb4aa68"
/** * image upload from WYSIWYG */ public function postEditorUpload($id = null) { header('Content-type: application/json'); $rows = $this->db('blog')->where('id', $id)->oneArray(); $dir = $this->_uploads.'/'.$rows['id']; $error = null; if (!file_exists($dir)) { mkdir($dir, 0777, true); } if (isset($_FILES['file']['tmp_name'])) { $img = new \Inc\Core\Lib\Image; if ($img->load($_FILES['file']['tmp_name'])) { $imgPath = $dir."/".time().'.'.$img->getInfos('type'); $img->save($imgPath); echo json_encode(['status' => 'success', 'result' => url($imgPath)]); } else { $error = $this->lang('editor_upload_fail'); } if ($error) { echo json_encode(['status' => 'failure', 'result' => $error]); } } exit(); }
Why this is not working ? I wanna upload img summernote on folder where is ID - POST ...
I will try $id, $rows['id'] - always i have code " /169160a0-693f-489c-b5cb-0b979cb4aa68"