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


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;
?>
ÃßõÃßõ : 512 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
193
¹®ÀÚ¿­¿¡¼­ ¼ýÀÚ¸¸ ³²±â°í ¸ðµÎ »èÁ¦
192
À̹øÁÖ, Áö³­ÁÖ, ´ÙÀ½ÁÖ ±â°£ ³¯Â¥ ±¸Çϱâ
191
fgetcsv() ÇÔ¼ö »ç¿ë½Ã ÇÑ±Û ±úÁö´Â ¹®Á¦ ÇØ°á
190
¼¼±Ý°è»ê¼­ °ø±Þ°¡¾×, ¼¼¾× °è»ê°ø½Ä
189
³¯Â¥°è»ê Á¤¸®
188
À¥ÆäÀÌÁöÀÇ ÇÊ¿äÇÑ ³»¿ë¸¸ °¡Á®¿À´Â Ŭ·¡½º (°Ô½ÃÆÇ ±Ü¾î¿À±â)
187
³¯Â¥°ü·Ã ÇÔ¼ö »ç¿ë¹æ¹ý
186
¼ýÀÚ°ü·Ã ÇÔ¼ö
185
Á¤±Ô Ç¥Çö½Ä ¿¹Á¦
184
Á¤±ÔÇ¥Çö½Ä
183
Áߺ¹¾ø´Â ¹«ÀÛÀ§ ¼ýÀÚ¸¸µé±â (·Î¶Çº¹±Ç)
182
ÀÚ¸´¼ö ¾Õ¿¡ 0 ÀÚµ¿À¸·Î ºÙ¿©ÁÖ±â
181
¿¹Á¦·Î ¹è¿ì´Â Á¤±ÔÇ¥Çö½Ä
180
each()
179
String ÇÔ¼ö ¸ñ·Ï
178
array ¹è¿­ ÇÔ¼ö ¸ñ·Ï
177
file()°ü·ÃÇÔ¼ö
176
php ÀÌÀü °æ·Î¸¦ ¾Ë¾Æ³»´Â ÇÔ¼ö
175
cookie(ÄíÅ°) & session(¼¼¼Ç)
174
°£´ÜÇÑ ¹®ÀÚ¿­ºÐ¸®,ã±â,º¯È¯
173
[PHP 5]http_build_query - url Äõ¸®¹®ÀÚ¿­ »ý¼ºÇÔ¼ö
172
URL¿¡¼­ ƯÁ¤°ª ÃßÃâÇϱâ...
171
file_exists ÆÄÀÏÀÌ ÀÖ´ÂÁö È®ÀÎ
170
PHP µ¿¿µ»ó °­ÁÂ
php ÆÄÀÏ ´Ù¿î·Îµå ±¸Çö
168
pcre ·Î °£´ÜÈ÷ ´Ü¾î¸¸ ÃßÃâÇϱâ
167
ÇØ´çÇÏ´Â ³¯Â¥°¡ ±×´ÞÀÇ ¸îÁÖ°ÀÎÁö °è»ê
166
PHP ¼¼¼Ç¿¡¼­ ½ÃÀÛ, º¯¼öµî·Ï, º¯¼ö»èÁ¦, ºÎ¼ö±â
165
phpÇѱÛüũ¸¦ À§ÇÑ Á¤±ÔÇ¥Çö½Ä
164
Æ®·¢¹é º¸³»±â ¼Ò½º (PHP)
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.