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


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


php¿ë ÆÄÀÏ´Ù¿î·Îµå ÇÔ¼ö·Î ÁÖ¼®À» º¸½Ã¸é ¾Æ½Ã°ÚÁö¸¸ ÇØ¿Ü »çÀÌÆ®¿¡¼­ °¡Á®¿Â ¼Ò½ºÀÔ´Ï´Ù. www.swish-db.comÀÇ ÆÄÀÏ´Ù¿î·Îµå 󸮸¦ ¹¯´Â Áú¹®¿¡ ´ëÇÑ ´äº¯À¸·Î ¿Ã·ÁÁø ¼Ò½ºÀε¥ Àç¹Õ´Â °ÍÀº ´äº¯ÇϽŠºÐµµ ù¹ø° Ãâó¸¦ ¸ð¸¥´Ù´Â °ÍÀÔ´Ï´Ù. ÇÏÁö¸¸ ºÐ¸íÈ÷ ±â¾ïÇÏ´Â °ÍÀº copyright free ¶ø´Ï´Ù. »ç¿ë¹ýÀº ´Ù¿î·ÎµåÇÒ ÆÄÀϸíÀ» ¹Þ¾Æ¼­ ÇÔ¼ö ÀÎÀÚ·Î ³Ñ°ÜÁÖ½Ã¸é µË´Ï´Ù. Å×½ºÆ® ÇØ º¸´Ï±î Àß µ¿ÀÛÇÕ´Ï´Ù.


<?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;
}
?>


ÃßõÃßõ : 243 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
742
PHP¿¡¼­ Á¢¼ÓÀÚ IP ¾Ë¾Æ³»±â
741
¸®´ª½º ftp ¸í·É¾î ¸ðÀ½
740
PHP ¹öºí¼ÒÆ® ¾Ë°í¸®Áò
739
PHP¿¡¼­ ¼º´É °³¼±À» À§ÇÑ À¯¿ëÇÑ ÆÁ
738
PHP Caching to speed up
737
[PHP] post, get, cookie, session º¯¼ö È®ÀÎ
736
PHP ¹®ÀÚ¿­Áß ¼ýÀÚ¸¸ ÃßÃâÇϱâ
735
PHP ¼Óµµ Å×½ºÆ® 14 °¡Áö
734
PHP ¸ÞÀÏ(mail) ÇÔ¼ö¸¦ ÀÌ¿ëÇÑ Ã·ºÎÈ­ÀÏ Àü¼ÛÇϱâ
733
PHP ÇÔ¼ö °£´Ü Á¤¸®
732
PHP¿¡¼­ ¼¼¼Ç(session) »ç¿ëÇϱâ
731
PHP explode ÇÔ¼ö¸¦ ÀÌ¿ëÇÑ ¹®ÀÚ¿­ ºÐ¸®
730
PHP split ÇÔ¼ö¸¦ ÀÌ¿ëÇÑ ¹®ÀÚ¿­ ºÐ¸®
729
PHP ¿À´Ã³¯Â¥¸¦ ±âÁØÀ¸·Î ÀÌÀü,ÀÌÈÄ ³¯Â¥±¸Çϱâ
728
PHP ÇÑ±Û ¹®ÀÚ¿­ ÀÚ¸£±â
727
PHP ¹öÀü È®ÀÎÇϱâ
726
PHP - SELECT·Î ¹ÝȯµÈ ·¹ÄÚµå °¹¼ö¿Í Ä÷³ÀÇ °¹¼ö¸¦ ¾Ë·ÁÁÖ´Â ÇÔ¼ö
725
PHP Æû(form)°ªÀÇ À¯È¿¼º üũ
724
PHP no-cache ¼³Á¤(µÚ·Î°¡±â ¸·±â)
723
PHP ¿¡·¯ ó¸® ÇÔ¼ö die
722
PHP MySQL ¸í·É¾î ½ÇÇà ÇÔ¼ö mysql_query
721
PHP·Î MySQL µ¥ÀÌÅͺ£À̽º ¸¸µé±â(»ý¼ºÇϱâ)
720
PHP¿Í ÀÚ¹Ù½ºÅ©¸³Æ®¸¦ ÀÌ¿ëÇÑ µå·Ó´Ù¿î ¸Þ´º
719
PHP - xml ÀоîµéÀ̱â(read) Ŭ·¡½º
718
PHP ÆÄÀÏ ½Ã½ºÅÛ(File System) ´Ù·ç±â #1
717
PHP ÆÄÀÏ ³»¿ë Àбâ(freadÇÔ¼ö)
716
PHP ÆÄÀÏ ÇÑÁÙ Àбâ(fgetsÇÔ¼ö)
715
PHP ÇöÀç ÆäÀÌÁöÀÇ µµ¸ÞÀθíÀ̳ª urlµîÀÇ Á¤º¸ ¾Ë¾Æ¿À±â
714
PHP - À¥»çÀÌÆ®ÀÇ À¯È¿¼º üũ
PHP - ÆÄÀÏ´Ù¿î·Îµå ÇÔ¼ö
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.