¾È±Ô °øºÎ¹æ

ACTIVE SERVER PAGE > File ´Ù¿î·Îµå

µî·ÏÀÏ : 2017-07-03 20:17 Á¶È¸¼ö : 52,958

^^ ¾È³çÇϼ¼¿ä.
   
º¸ÅëÀÇ ÀÚ·á½Ç¿¡ º¸¸é,,,
text È­ÀÏÀ̳ª ±×¸²,, ¶Ç´Â Office °ü·Ã È­ÀϵéÀº ºê¶ó¿ìÁ®¿¡¼­ ÀÚµ¿À¸·Î ¶ç¿ö
¹ö¸³´Ï´Ù.  
 
±×·³, ¸¸¾à text,±×¸²,Office È­ÀϱîÁöµµ ´Ù¿îÀ» ¹Þ°í ½Í´Ù¸é ¾î¶»°Ô ÇÏ¸é µÉ±î¿©?
   
ContentType °ú html Çì´õÀÇ Á¶ÀÛÀ¸·Î °¡´ÉÇÕ´Ï´Ù.
IIS¿¡¼­ MIME TypeÀ» ¼³Á¤ÇÒ¼öµµ, ¹Ù²Ü¼öµµ ÀÖ´Ù´Â »ç½ÇÀº ¾Ë°í °è½Ã¸®¶ó ¹Ï½À´Ï´Ù.
 
	down.asp 
	-------------------------------------------------------------------
	fname=Request("fname")
	str_dir="d:\wwwroot\skylla\databank\download\"
	Response.ContentType = "application/unknown"
	Response.AddHeader "Content-Disposition","attachment; filename="&fname
	Set objStm = Server.CreateObject("ADODB.Stream")
	objStm.Open
	objStm.LoadFromFile str_dir&fname
	strFile = objStm.ReadText

	Response.BinaryWrite strFile


ÀÏ´Ü ´Ù¿î ¹öÆ°À» ´©¸£¸é,,,     down.asp È­ÀÏ·Î º¸³À´Ï´Ù.
down.asp?fname=a.txt ÀÌ·±½ÄÀ¸·Î º¸³»¸é µÇ°ÚÁö¿ä?
µ¥ÀÌŸ º£À̽º¿¡ È­ÀÏÀ̸§ÀÌ ÀúÀåµÇ¾î ÀÖÀ» °Ì´Ï´Ù.
    
À§ÀÇ ¼Ò½º¿¡¼­´Â ADO 2.5 ¿¡ Æ÷ÇԵǾî ÀÖ´Â Stream °´Ã¼¸¦ ÀÌ¿ëÇÏ¿©
´Ù¿î ¹Þ´Â ºÎºÐÀ» ÇØ°áÇß½À´Ï´Ù.
    
Stream °´Ã¼¿¡ Æ÷ÇԵǾî ÀÖ´Â LoadFromFile ¸Þ¼Òµå¿Í ReadText ¸Þ¼Òµå¸¦ ÀÌ¿ëÇؼ­
È­ÀÏÀ» ÀÐ¾î ¿Ô½À´Ï´Ù.
    
Response.BinaryWrite ¸¦ ÀÌ¿ëÇØ Å¬¶óÀÌ ¾ðÆ®¿¡ ÀúÀåÇÏ°Ô µË´Ï´Ù. ^^

filename="&fname Àº ÀúÀåÇÒ È­ÀÏÀÇ À̸§À̶ø´Ï´Ù.
    
»ý°¢º¸´Ü ³Ê¹« °£´ÜÇÏÁö¿ä?
    
µµ¿òÀÌ µÇ¼Ì±æ ¹Ù¶ø´Ï´Ù.

¾Æ·¡´Â ¶Ç´Ù¸¥ ¹æ¹ýÀÔ´Ï´Ù.(SiteGalaxyUpload)

Response.ContentType ="application/x-gzip"
fname=Request("fname")
Response.AddHeader "Content-Disposition", "attachment;filename="&fname
str_dir="c:\temp\"
set fso = server.CreateObject ("SiteGalaxyUpload.filesystemobject")
set file = fso.OpenBinaryFile (str_dir&fname,1,false)
Response.BinaryWrite file.readall
Response.End
 
 
ContentType Á¾·ù

Response.ContentType = "application/x-msdownload"
Response.ContentType = "application/x-gzip"
Response.ContentType = "application/unknown"
Response.ContentType = "application/vnd.ms-excel"
 
¡Ø Ȥ½Ã µµ¿òÀÌ µÇ¼Ì´Ù¸é ´ñ±Û¿¡ ÇѸ¶µð ³²°ÜÁÖ¼¼¿ä!
ÀÛ¼ºÀÚ   ºñ¹Ð¹øÈ£
ÀÚµ¿±Û ¹æÁö     (ÀÚµ¿±Û ¹æÁö ±â´ÉÀÔ´Ï´Ù.)
³»¿ë   ´ñ±Û´Þ±â 
À̸ÞÀÏ ¹®ÀÇ : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.