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


PHP - ÆÄÀÏ´Ù¿î·Îµå ÇÔ¼ö
13³â Àü
<?php

dl_file("file.zip"); // or whatever the file name is.
function dl_file($file){
//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;
}
?>

ÃßõÃßõ : 483 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,985
PHP ÇÑ±Û ¹®ÀÚ¿­ ÀÚ¸£±â
1,984
PHP ¹öÀü È®ÀÎÇϱâ
1,983
PHP - SELECT·Î ¹ÝȯµÈ ·¹ÄÚµå °¹¼ö¿Í Ä÷³ÀÇ °¹¼ö¸¦ ¾Ë·ÁÁÖ´Â ÇÔ¼ö
1,982
PHP Æû(form)°ªÀÇ À¯È¿¼º üũ
1,981
PHP no-cache ¼³Á¤(µÚ·Î°¡±â ¸·±â)
1,980
PHP ¿¡·¯ ó¸® ÇÔ¼ö die
1,979
PHP MySQL ¸í·É¾î ½ÇÇà ÇÔ¼ö mysql_query
1,978
PHP·Î MySQL µ¥ÀÌÅͺ£À̽º ¸¸µé±â(»ý¼ºÇϱâ)
1,977
PHP¿Í ÀÚ¹Ù½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÑ µå·Ó´Ù¿î ¸Þ´º
1,976
PHP - xml ÀоîµéÀ̱â(read) Ŭ·¡½º
1,975
PHP ÆÄÀÏ ½Ã½ºÅÛ(File System) ´Ù·ç±â #1
1,974
PHP ÆÄÀÏ ³»¿ë Àбâ(freadÇÔ¼ö)
1,973
PHP ÆÄÀÏ ÇÑÁÙ Àбâ(fgetsÇÔ¼ö)
1,972
PHP ÇöÀç ÆäÀÌÁöÀÇ µµ¸ÞÀθíÀ̳ª urlµîÀÇ Á¤º¸ ¾Ë¾Æ¿À±â
1,971
PHP - À¥»çÀÌÆ®ÀÇ À¯È¿¼º üũ
1,970
fsockopen ÇÔ¼ö¸¦ ÀÌ¿ëÇؼ­ À¥»çÀÌÆ®¿¡ µ¥ÀÌÅÍ Àü¼ÛÇϱâ
PHP - ÆÄÀÏ´Ù¿î·Îµå ÇÔ¼ö
1,968
PHP ÆÄÀÏ 1¹ÙÀÌÆ®¾¿ Àбâ(fgetcÇÔ¼ö)
1,967
PHP °£´ÜÇÑ ÆÄÀÏ ¾÷·Îµå(upload) ¿¹Á¦
1,966
PHP ¹®ÀÚ¿­ÀÇ ±æÀ̸¦ °°°Ô ¸¸µé±â
1,965
PHP $HTTP_COOKIE_VARS·Î °ªÀÌ ¾È ³Ñ¾î¿Ã¶§
1,964
PHP ³­¼ö¸¦ ÀÌ¿ëÇÑ ÄíÆù¹øÈ£ »ý¼ºÇϱâ
1,963
PHP - POST ¹æ½ÄÀÇ ÆÄÀÏ ¾÷·Îµå ´Ù·ç±â
1,962
PHP - Á¤±Ô½ÄÀ» ÀÌ¿ëÇÑ IPÁÖ¼Ò À¯È¿¼º üũ
1,961
PHP - ³âµµ¸¦ Ç¥½ÃÇØ ÁÖ´Â ¼¿·ºÆ®¹Ú½º(SELECT BOX)
1,960
PHP ¼±ÅÃµÈ ´Ù¼ö(¿©·¯°³)ÀÇ Ã¼Å©¹Ú½º °ª ³Ñ±â±â
1,959
PHP ƯÁ¤ µð·ºÅ丮¿¡ ÀÖ´Â ÆÄÀÏ °¹¼ö ±¸Çϱâ
1,958
PHP È®ÀåÀÚ ±¸Çϱâ
1,957
¹èÄ¡ÆÄÀÏ ¸í·É¾î ¸ðÀ½
1,956
°øÀ¯ Æú´õ ¸ÅÀÏ ¹Ù²Ù±â ÀÚµ¿ ¹èÄ¡ ÆÄÀÏ
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.