예제 #1
0
파일: store.php 프로젝트: camigreen/ttop
 public function photoUpload()
 {
     //        $files = $this->app->request->get('files[]','array');
     $this->app->document->setMimeEncoding('application/json');
     $id = uniqid();
     $files = jRequest::get('FILES')['files'];
     $post = jRequest::get('GET');
     $path = $files['tmp_name'][0];
     $upload_path = 'images' . DIRECTORY_SEPARATOR . 'customer_upload' . DIRECTORY_SEPARATOR . 'tm' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . $files['name'][0];
     try {
         $success = JFile::upload($path, $upload_path);
         $data = array('path' => JURI::root() . $upload_path, 'uniqID' => $id);
         $message = null;
         echo new JResponseJson($data, $message, !$success);
     } catch (Exception $e) {
         echo new JResponseJson($e);
     }
 }