mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
좀 더 정확하게 파일 경로 지정
This commit is contained in:
parent
7125cf0e12
commit
dc79c3ea9d
2 changed files with 27 additions and 3 deletions
|
|
@ -45,13 +45,15 @@ class fileController extends file
|
||||||
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
|
||||||
|
|
||||||
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
|
||||||
|
|
||||||
Context::setResponseMethod('JSON');
|
Context::setResponseMethod('JSON');
|
||||||
$this->add('file_srl', $output->get('file_srl'));
|
$this->add('file_srl', $output->get('file_srl'));
|
||||||
$this->add('file_size', $output->get('file_size'));
|
$this->add('file_size', $output->get('file_size'));
|
||||||
$this->add('direct_download', $output->get('direct_download'));
|
$this->add('direct_download', $output->get('direct_download'));
|
||||||
$this->add('source_filename', $output->get('source_filename'));
|
$this->add('source_filename', $output->get('source_filename'));
|
||||||
$this->add('download_url', $output->get('uploaded_filename'));
|
|
||||||
$this->add('upload_target_srl', $output->get('upload_target_srl'));
|
$this->add('upload_target_srl', $output->get('upload_target_srl'));
|
||||||
|
$this->add('download_url', $oFileModel->getDirectFileUrl($output->get('uploaded_filename')));
|
||||||
|
|
||||||
if($output->error != '0') $this->stop($output->message);
|
if($output->error != '0') $this->stop($output->message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,14 @@ class fileModel extends file
|
||||||
$obj->source_filename = $file_info->source_filename;
|
$obj->source_filename = $file_info->source_filename;
|
||||||
$obj->file_size = $file_info->file_size;
|
$obj->file_size = $file_info->file_size;
|
||||||
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
$obj->disp_file_size = FileHandler::filesize($file_info->file_size);
|
||||||
if($file_info->direct_download=='N') $obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl);
|
if($file_info->direct_download == 'N')
|
||||||
else $obj->download_url = $file_info->uploaded_filename;
|
{
|
||||||
|
$obj->download_url = $this->getDownloadUrl($file_info->file_srl, $file_info->sid, $file_info->module_srl);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$obj->download_url = $this->getDirectFileUrl($file_info->uploaded_filename);
|
||||||
|
}
|
||||||
$obj->direct_download = $file_info->direct_download;
|
$obj->direct_download = $file_info->direct_download;
|
||||||
$obj->cover_image = ($file_info->cover_image === 'Y') ? true : false;
|
$obj->cover_image = ($file_info->cover_image === 'Y') ? true : false;
|
||||||
$files[] = $obj;
|
$files[] = $obj;
|
||||||
|
|
@ -109,7 +115,23 @@ class fileModel extends file
|
||||||
{
|
{
|
||||||
return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl);
|
return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s&module_srl=%s', 'file', 'procFileDownload', $file_srl, $sid, $module_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return direct download file url
|
||||||
|
*
|
||||||
|
* @param string $path
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getDirectFileUrl($path)
|
||||||
|
{
|
||||||
|
if(dirname($_SERVER['SCRIPT_NAME']) == '/' || dirname($_SERVER['SCRIPT_NAME']) == '\\')
|
||||||
|
{
|
||||||
|
return '/' . substr($path, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dirname($_SERVER['SCRIPT_NAME']) . '/' . substr($path, 2);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get file configurations
|
* Get file configurations
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue