public function API_mobileUp() { $this->auth or iPHP::code(0, 'iCMS:!login', 0, 'json'); $F = iFS::upload('upfile'); $F['path'] && ($url = iFS::fp($F['path'], '+http')); iPHP::js_callback(array('url' => $url, 'code' => $F['code'])); }
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); } }