Ejemplo n.º 1
0
 function do_uploadscrawl()
 {
     if ($_GET["action"] == "tmpImg") {
         // 背景上传
         iFS::$callback = false;
         $F = iFS::upload('upfile', 'scrawl/tmp');
         $F === false && exit;
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         echo "<script>parent.ue_callback('" . $url . "','SUCCESS')</script>";
     } else {
         iFS::$callback = true;
         $F = iFS::base64ToFile($_POST['upfile'], 'scrawl/' . get_date(0, 'Y/md'));
         $F === false && exit(iFS::$ERROR);
         $F['path'] && ($url = iFS::fp($F['path'], '+http'));
         $tmp = iFS::get_dir() . "scrawl/tmp/";
         iFS::rmdir($tmp);
         iPHP::json(array("url" => $url, "state" => 'SUCCESS'));
     }
 }
Ejemplo n.º 2
0
 function do_upload()
 {
     iACP::MP('FILE.UPLOAD', 'alert');
     //iFS::$checkFileData = true;
     $_POST['watermark'] or iFS::$watermark = false;
     iFS::$callback = true;
     if ($this->id) {
         iFS::$FileData = iFS::getFileData('id', $this->id);
         $F = iFS::upload('upfile');
         if ($F && $F['size'] != iFS::$FileData->size) {
             iDB::query("update `#iCMS@__filedata` SET `size`='" . $F['size'] . "' WHERE `id` = '{$this->id}'");
         }
     } else {
         $udir = ltrim($_POST['udir'], '/');
         $F = iFS::upload('upfile', $udir);
     }
     $array = $F === false ? iFS::$ERROR : array("value" => $F["path"], "url" => iFS::fp($F['path'], '+http'), "fid" => $F["fid"], "fileType" => $F["ext"], "image" => in_array($F["ext"], array('gif', 'jpg', 'jpeg', 'png')) ? 1 : 0, "original" => $F["oname"], "state" => $F['code'] ? 'SUCCESS' : $F['state']);
     if ($this->format == 'json') {
         iPHP::json($array);
     } else {
         iPHP::js_callback($array);
     }
 }