파일이름의 확장자로 파일 종류를 확인하는 함수입니다.
미디어스킨 또는 이미지 관련스킨에 유용할듯해서 올립니다.
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;
}
// phpschool에서 펌<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
미디어스킨 또는 이미지 관련스킨에 유용할듯해서 올립니다.
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;
}
// phpschool에서 펌<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 830 |
|
19년 전 | 2187 | |
| 829 |
|
19년 전 | 1922 | |
| 828 |
|
19년 전 | 1811 | |
| 827 |
|
19년 전 | 1655 | |
| 826 |
|
19년 전 | 1850 | |
| 825 |
|
19년 전 | 1895 | |
| 824 |
|
19년 전 | 1949 | |
| 823 |
|
19년 전 | 2690 | |
| 822 |
|
19년 전 | 5321 | |
| 821 |
|
19년 전 | 1724 | |
| 820 |
|
19년 전 | 1577 | |
| 819 |
|
19년 전 | 1442 | |
| 818 |
|
19년 전 | 1602 | |
| 817 |
|
19년 전 | 1523 | |
| 816 |
|
19년 전 | 1448 | |
| 815 |
|
19년 전 | 1460 | |
| 814 |
|
19년 전 | 1383 | |
| 813 |
|
19년 전 | 1447 | |
| 812 | 19년 전 | 2820 | ||
| 811 |
pearly
|
19년 전 | 3837 | |
| 810 |
pearly
|
19년 전 | 5214 | |
| 809 |
|
19년 전 | 1378 | |
| 808 |
pearly
|
19년 전 | 4542 | |
| 807 | 19년 전 | 2980 | ||
| 806 |
|
19년 전 | 1504 | |
| 805 |
|
19년 전 | 2692 | |
| 804 |
|
19년 전 | 3618 | |
| 803 |
|
19년 전 | 1811 | |
| 802 |
|
19년 전 | 3791 | |
| 801 |
|
19년 전 | 1883 | |
| 800 | 19년 전 | 3771 | ||
| 799 | 19년 전 | 3436 | ||
| 798 | 19년 전 | 4207 | ||
| 797 | 19년 전 | 4067 | ||
| 796 |
|
19년 전 | 1897 | |
| 795 |
|
19년 전 | 1855 | |
| 794 | 19년 전 | 4277 | ||
| 793 | 19년 전 | 2669 | ||
| 792 | 19년 전 | 2548 | ||
| 791 | 19년 전 | 2399 | ||
| 790 | 19년 전 | 1979 | ||
| 789 | 19년 전 | 2594 | ||
| 788 | 19년 전 | 2206 | ||
| 787 | 19년 전 | 1848 | ||
| 786 | 19년 전 | 1974 | ||
| 785 | 19년 전 | 1443 | ||
| 784 |
|
19년 전 | 1696 | |
| 783 | 19년 전 | 2840 | ||
| 782 |
|
19년 전 | 1960 | |
| 781 | 19년 전 | 3247 | ||
| 780 | 19년 전 | 3157 | ||
| 779 |
|
19년 전 | 2246 | |
| 778 |
|
19년 전 | 1797 | |
| 777 | 19년 전 | 2842 | ||
| 776 | 19년 전 | 2906 | ||
| 775 | 19년 전 | 4020 | ||
| 774 |
|
19년 전 | 1981 | |
| 773 | 19년 전 | 2622 | ||
| 772 | 19년 전 | 2342 | ||
| 771 | 19년 전 | 3473 | ||
| 770 |
|
19년 전 | 1439 | |
| 769 | 19년 전 | 1500 | ||
| 768 | 19년 전 | 1771 | ||
| 767 | 19년 전 | 2202 | ||
| 766 | 19년 전 | 1834 | ||
| 765 | 19년 전 | 1694 | ||
| 764 |
|
19년 전 | 2115 | |
| 763 |
|
19년 전 | 2219 | |
| 762 |
|
19년 전 | 4964 | |
| 761 | 19년 전 | 2328 | ||
| 760 |
|
19년 전 | 3195 | |
| 759 | 19년 전 | 2642 | ||
| 758 |
|
19년 전 | 2405 | |
| 757 | 19년 전 | 4699 | ||
| 756 | 19년 전 | 2570 | ||
| 755 |
|
19년 전 | 2417 | |
| 754 |
|
19년 전 | 1956 | |
| 753 |
|
19년 전 | 1740 | |
| 752 |
pearly
|
19년 전 | 3369 | |
| 751 | 19년 전 | 2348 | ||
| 750 |
|
19년 전 | 6164 | |
| 749 | 19년 전 | 2032 | ||
| 748 |
|
19년 전 | 1905 | |
| 747 |
|
19년 전 | 2705 | |
| 746 |
|
19년 전 | 1816 | |
| 745 | 19년 전 | 2282 | ||
| 744 | 19년 전 | 2112 | ||
| 743 |
|
19년 전 | 3570 | |
| 742 | 19년 전 | 2582 | ||
| 741 | 19년 전 | 2747 | ||
| 740 |
|
19년 전 | 4371 | |
| 739 | 19년 전 | 3548 | ||
| 738 |
|
19년 전 | 2307 | |
| 737 | 19년 전 | 4314 | ||
| 736 | 19년 전 | 3269 | ||
| 735 |
홀로남은자
|
19년 전 | 4140 | |
| 734 |
홀로남은자
|
19년 전 | 2029 | |
| 733 |
홀로남은자
|
19년 전 | 2230 | |
| 732 | 19년 전 | 2139 | ||
| 731 | 19년 전 | 3354 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기