| 제목 | 이미지 업로드 시 확장자명과 파일형식이 다른 경우 | ||
|---|---|---|---|
| 글쓴이 | 슘님 | 작성시각 | 2014/06/12 16:03:01 | 
|  | |||
| 게시판에 해당 내용을 검색해보니 없는 듯 하여 올려봅니다. 이미지 업로드 하실 경우 확장자명과 파일형식이 다르면 (확장자명: png, 파일형식: image/jpg) "The filetype you are attempting to upload is not allowed." 위의 에러를 리턴합니다. 이미지 파일이 명확한 경우 엄격한 체크를 하지 않도록 수정해봤습니다. ($CI_HOME/libraries/Upload.php, 라인 604부터) 좀 무식합니다... 
// Images get some additional checks
$image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
if (in_array($ext, $image_types))
{
	if (getimagesize($this->file_temp) === FALSE)
	{
		return FALSE;
	}
	
	// If the file is image definitely, make additional checks loosely
	$mime = array();
	
	foreach ($image_types as $image_type)
	{
		$mimes = $this->mimes_types($image_type);
		
		if (is_array($mimes))
		{
			foreach ($mimes as $m)
			{
				$mime[] = $m;
			}
		}
		else
		{
			$mime[] = $mimes;
		}
	}
}
else 
{
    $mime = $this->mimes_types($ext);
}
if ($ignore_mime === TRUE)
{
    return TRUE;
}
//$mime = $this->mimes_types($ext);
 | |||
| 다음글 | ci 1.7.x사용중 png의 배경 검은색 문제 (2) | ||
| 이전글 | 2.1.x 에 보안 문제가 있다고 하네요. (2) | ||
| 
                                한대승(불의회상)
                                /
                                2014/06/17 09:24:57 /
                                추천
                                0
                             
                                좋은 정보 감사 합니다. 
                             |