ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


php ÆÄÀÏ ´Ù¿î·Îµå ±¸Çö
12³â Àü
<?
   //First, see if the file exists
   if (!is_file($file)) { die("<b>404 File not found!</b>"); }



   //Gather relevent info about file
   $len = filesize($file);
   $filename = basename($file);
   $file_extension = strtolower(substr(strrchr($filename,"."),1));



   //This will set the Content-Type to the appropriate setting for the file
   switch( $file_extension ) {
     case "pdf": $ctype="application/pdf"; break;
     case "exe": $ctype="application/octet-stream"; break;
     case "zip": $ctype="application/zip"; break;
     case "doc": $ctype="application/msword"; break;
     case "xls": $ctype="application/vnd.ms-excel"; break;
     case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
     case "gif": $ctype="image/gif"; break;
     case "png": $ctype="image/png"; break;
     case "jpeg":
     case "jpg": $ctype="image/jpg"; break;
     case "mp3": $ctype="audio/mpeg"; break;
     case "wav": $ctype="audio/x-wav"; break;
     case "mpeg":
     case "mpg":
     case "mpe": $ctype="video/mpeg"; break;
     case "mov": $ctype="video/quicktime"; break;
     case "avi": $ctype="video/x-msvideo"; break;



     //The following are for extensions that shouldn't be downloaded (sensitive stuff, like php files)
     case "php":
     case "htm":
     case "html":
     case "txt": die("<b>Cannot be used for ". $file_extension ." files!</b>"); break;



     default: $ctype="application/force-download";
   }



   //Begin writing headers
   header("Pragma: public");
   header("Expires: 0");
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
   header("Cache-Control: public");
   header("Content-Description: File Transfer");
  
   //Use the switch-generated Content-Type
   header("Content-Type: $ctype");



   //Force the download
   $header="Content-Disposition: attachment; filename=".$filename.";";
   header($header );
   header("Content-Transfer-Encoding: binary");
   header("Content-Length: ".$len);
   @readfile($file);
   exit;
?>
ÃßõÃßõ : 516 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
2,405
¿Ã¹Ù¸¥ ¼øÀ§ Á¤·Ä °á°ú¸¦ ¾ò´Â ¹æ¹ý
2,404
³¯Â¥°ü·Ã ÇÔ¼ö »ç¿ë¹æ¹ý
2,403
¼ýÀÚ°ü·Ã ÇÔ¼ö
2,402
Á¤±Ô Ç¥Çö½Ä ¿¹Á¦
2,401
Á¤±ÔÇ¥Çö½Ä
2,400
Áߺ¹¾ø´Â ¹«ÀÛÀ§ ¼ýÀÚ¸¸µé±â (·Î¶Çº¹±Ç)
2,399
[MySQL] Áߺ¹µÈ ÇʵåÀÇ °¹¼ö ±¸Çϱâ
2,398
ÀÚ¸´¼ö ¾Õ¿¡ 0 ÀÚµ¿À¸·Î ºÙ¿©ÁÖ±â
2,397
¿¹Á¦·Î ¹è¿ì´Â Á¤±ÔÇ¥Çö½Ä
2,396
each()
2,395
String ÇÔ¼ö ¸ñ·Ï
2,394
array ¹è¿­ ÇÔ¼ö ¸ñ·Ï
2,393
file()°ü·ÃÇÔ¼ö
2,392
php ÀÌÀü °æ·Î¸¦ ¾Ë¾Æ³»´Â ÇÔ¼ö
2,391
cookie(ÄíÅ°) & session(¼¼¼Ç)
2,390
°£´ÜÇÑ ¹®ÀÚ¿­ºÐ¸®,ã±â,º¯È¯
2,389
[PHP 5]http_build_query - url Äõ¸®¹®ÀÚ¿­ »ý¼ºÇÔ¼ö
2,388
URL¿¡¼­ ƯÁ¤°ª ÃßÃâÇϱâ...
2,387
Ç÷¡½¬ ¾×¼Ç fscommand ¸í·ÉÀÇ Á¾·ù
2,386
file_exists ÆÄÀÏÀÌ ÀÖ´ÂÁö È®ÀÎ
2,385
PHP µ¿¿µ»ó °­ÁÂ
php ÆÄÀÏ ´Ù¿î·Îµå ±¸Çö
2,383
pcre ·Î °£´ÜÈ÷ ´Ü¾î¸¸ ÃßÃâÇϱâ
2,382
ÇØ´çÇÏ´Â ³¯Â¥°¡ ±×´ÞÀÇ ¸îÁÖ°ÀÎÁö °è»ê
2,381
PHP ¼¼¼Ç¿¡¼­ ½ÃÀÛ, º¯¼öµî·Ï, º¯¼ö»èÁ¦, ºÎ¼ö±â
2,380
phpÇѱÛüũ¸¦ À§ÇÑ Á¤±ÔÇ¥Çö½Ä
2,379
Æ®·¢¹é º¸³»±â ¼Ò½º (PHP)
2,378
RSS ¸®´õ±â
2,377
heredocÀÌ¿ëÇÑ Ãâ·Â ¿¹
2,376
¸®½ºÆ®¿ë Å×ÀÌºí »ý¼º°ú ³»¿ëÃâ·Â
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.