mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-18 02:39:56 +09:00
원격 파일 다운로드시 한글파일명 처리할 수 있도록 수정
git-svn-id: http://xe-core.googlecode.com/svn/trunk@2067 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
70713a033a
commit
c9429067b1
1 changed files with 14 additions and 2 deletions
|
|
@ -137,8 +137,20 @@
|
|||
$fp = @fsockopen($url_info['host'], $url_info['port']);
|
||||
if(!$fp) return;
|
||||
|
||||
$url_info['path'] = str_replace(' ','%20',$url_info['path']);
|
||||
$header = sprintf("GET %s HTTP/1.0\r\nHost: %s\r\nReferer: %s://%s\r\nRequestUrl: %s\r\n\r\n", $url_info['path'], $url_info['host'], $url_info['scheme'], $url_info['host'], Context::getRequestUri());
|
||||
// 한글 파일이 있으면 한글파일 부분만 urlencode하여 처리 (iconv 필수)
|
||||
$path = $url_info['path'];
|
||||
if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) {
|
||||
$path_list = explode('/',$path);
|
||||
$cnt = count($path_list);
|
||||
$filename = $path_list[$cnt-1];
|
||||
$filename = urlencode(iconv("UTF-8","EUC-KR",$filename));
|
||||
$path_list[$cnt-1] = $filename;
|
||||
$path = implode('/',$path_list);
|
||||
$url_info['path'] = $path;
|
||||
}
|
||||
|
||||
$header = sprintf("GET %s HTTP/2.0\r\nHost: %s\r\nReferer: %s://%s\r\nRequestUrl: %s\r\n\r\n", $url_info['path'], $url_info['host'], $url_info['scheme'], $url_info['host'], Context::getRequestUri());
|
||||
|
||||
@fwrite($fp, $header);
|
||||
|
||||
$ft = @fopen($target_filename, 'w');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue