파일이름의 확장자로 파일 종류를 확인하는 함수입니다.
미디어스킨 또는 이미지 관련스킨에 유용할듯해서 올립니다.
function file_type($filename)
{
$tmp = explode(".", $filename);
$ext = trim($tmp[count($tmp)-1]);
$type_image = "jpg|jpeg|gif|bmp|pcx|png";
$type_compress = "zip|alz|gz|tar|z|rar|ace|bz|bz2";
$type_text = "txt|text|rtf|2b";
$type_html = "htm|html";
$type_hwp = "hwp|h30";
$type_exe = "exe";
$type_font = "ttf";
$type_movie = "avi|mpg|mpeg|mqv|asf|wmv|mov";
$type_sound = "wav|mp3|mid|wma";
if(preg_match("/($type_image)/i",$ext))
$file_type = 'image';
else if(preg_match("/($type_compress)/i",$ext))
$file_type = 'compress';
else if(preg_match("/($type_text)/i",$ext))
$file_type = 'text';
else if(preg_match("/($type_html)/i",$ext))
$file_type = 'html';
else if(preg_match("/($type_hwp)/i",$ext))
$file_type = 'hwp';
else if(preg_match("/($type_exe)/i",$ext))
$file_type = 'exe';
else if(preg_match("/($type_font)/i",$ext))
$file_type = 'font';
else if(preg_match("/($type_movie)/i",$ext))
$file_type = 'movie';
else if(preg_match("/($type_sound)/i",$ext))
$file_type = 'sound';
else
$file_type = 'unknown';
return $file_type;
}
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 30 |
아우겐나이스
|
21년 전 | 4050 | |
| 29 |
아우겐나이스
|
21년 전 | 4436 | |
| 28 |
아우겐나이스
|
21년 전 | 3463 | |
| 27 | 21년 전 | 5833 | ||
| 26 | 21년 전 | 3112 | ||
| 25 | 21년 전 | 6081 | ||
| 24 | 18년 전 | 3649 | ||
| 23 | 21년 전 | 3640 | ||
| 22 | 21년 전 | 4247 | ||
| 21 | 21년 전 | 3817 | ||
| 20 | 21년 전 | 4225 | ||
| 19 | 21년 전 | 6678 | ||
| 18 | 21년 전 | 4733 | ||
| 17 | 21년 전 | 6989 | ||
| 16 | 21년 전 | 4170 | ||
| 15 | 21년 전 | 2631 | ||
| 14 | 21년 전 | 4977 | ||
| 13 | 21년 전 | 3399 | ||
| 12 |
Recluse
|
21년 전 | 3879 | |
| 11 |
아우겐나이스
|
21년 전 | 3568 | |
| 10 |
Recluse
|
21년 전 | 3392 | |
| 9 | 21년 전 | 3990 | ||
| 8 | 21년 전 | 5171 | ||
| 7 | 21년 전 | 4761 | ||
| 6 | 21년 전 | 5685 | ||
| 5 | 21년 전 | 4114 | ||
| 4 | 21년 전 | 4839 | ||
| 3 | 21년 전 | 4740 | ||
| 2 | 21년 전 | 3244 | ||
| 1 | 22년 전 | 4340 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기