* Finish task #6541.
This commit is contained in:
@@ -102,47 +102,6 @@ class file extends control
|
||||
die(json_encode(array('status' => 'error', 'message' => $this->lang->file->uploadImagesExplain)));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get upload request from the web editor.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxUeditorUpload($uid = '')
|
||||
{
|
||||
if($this->get->action == 'config')
|
||||
{
|
||||
die(json_encode($this->config->file->ueditor));
|
||||
}
|
||||
|
||||
$file = $this->file->getUpload('upfile');
|
||||
$file = $file[0];
|
||||
if($file)
|
||||
{
|
||||
if($file['size'] == 0) die(json_encode(array('state' => $this->lang->file->errorFileUpload)));
|
||||
if(@move_uploaded_file($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
{
|
||||
/* Compress image for jpg and bmp. */
|
||||
$file = $this->file->compressImage($file);
|
||||
|
||||
$file['addedBy'] = $this->app->user->account;
|
||||
$file['addedDate'] = helper::today();
|
||||
unset($file['tmpname']);
|
||||
$this->dao->insert(TABLE_FILE)->data($file)->exec();
|
||||
|
||||
$fileID = $this->dao->lastInsertID();
|
||||
$url = $this->createLink('file', 'read', "fileID=$fileID", $file['extension']);
|
||||
if($uid) $_SESSION['album'][$uid][] = $fileID;
|
||||
die(json_encode(array('state' => 'SUCCESS', 'url' => $url)));
|
||||
}
|
||||
else
|
||||
{
|
||||
$error = strip_tags(sprintf($this->lang->file->errorCanNotWrite, $this->file->savePath, $this->file->savePath));
|
||||
die(json_encode(array('state' => $error)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Down a file.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user