예제 #1
0
     $uploader->upFile('9999_' . time() . rand(1000, 9999));
     mylog('frontUp');
     $inf = $uploader->getFileInfo();
     if ('SUCCESS' == $inf['state']) {
         $id = pdoInsert('ad_tbl', array('category' => 'banner', 'img_url' => $inf['url']), '');
         $inf['id'] = $id;
     }
     //        header('contentType:application/json');
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     mylog('imgUploaded:' . $jsonInf);
     echo $jsonInf;
     exit;
 }
 if (isset($_FILES['parts-img-up'])) {
     $uploader = new uploader('parts-img-up');
     $uploader->upFile($_GET['g_id'] . '_' . time() . rand(1000, 9999));
     $inf = $uploader->getFileInfo();
     $jsonInf = json_encode($inf, JSON_UNESCAPED_UNICODE);
     if ('SUCCESS' == $inf['state']) {
         mylog('success');
         $temp = pdoQuery('g_image_tbl', null, array('g_id' => $_GET['g_id']), 'limit 1');
         if (!($row = $temp->fetch())) {
             pdoInsert('g_image_tbl', array('g_id' => $_GET['g_id'], 'url' => $inf['url'], 'remark' => $inf['md5']), 'ignore');
             mylog("create record");
         } else {
             pdoUpdate('g_image_tbl', array('remark' => $inf['md5'], 'url' => $inf['url']), array('g_id' => $_GET['g_id']));
             $query = pdoQuery('image_view', null, array('remark' => $row['remark']), ' limit 1');
             if (!($t = $query->fetch())) {
                 unlink('../' . $row['url']);
                 mylog('unlink"../' . $row['url']);
             } else {