ACTIVE SERVER PAGE > ±Û¾²±â (filename , Sitegalaxy) µî·ÏÀÏ : 2017-07-03 20:14 Á¶È¸¼ö : 52,968¿©±â¼´Â (fileman.dll) ÄÄÆ÷³ÍÆ®¸¦ ÀÌ¿ëÇؼ
ÀÚ·á½ÇÀ» ±¸ÃàÇÏ´Â ¹æ¹ýÀ» ±â¼úÇÏ°Ú½À´Ï´Ù. ÄÄÆ÷³ÍÆ®´Â ÀÚ·á½Ç¿¡¼ ´Ù¿î ¹ÞÀ»¼ö ÀÖ½À´Ï´Ù. 3.1.1. ÄÄÆ÷³ÍÆ®¸¦ ¼¹ö(·¹Áö½ºÆ®¸®) µî·Ï ¹æ¹ý. °¡. ¸ÕÀú Fileman.zip ¾ÐÃàÀ» Ǭ´Ù. ³ª. C:\Winnt\system32\inetsrv\cmpnts ¿¡ fileman.dll¸¦ º¹»çÇÑ´Ù. ´Ù. C:\Winnt\system32\inetsrv\cmpnts >¿¡¼ regsvr32 Fileman.dll À̶ó°í Ä£´Ù.(µî·Ï) ¶ó. Fileman.dll¸¦ ÇØÁ¦ÇÏ°í ½Í´Ù¸é C:\Winnt\system32\inetsrv\cmpnts >regsvr32 Fileman.dll /u ¶ó±¸ Ä£´Ù. 3.1.2. ÀÚ·á½Ç ±Û¾²±â(write.asp) <FORM ACTION="write_ok.asp" ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST"> <INPUT TYPE="TEXT" NAME="NAME"> <INPUT TYPE="FILE" NAME="FILE1"> <input type="SUBMIT" value="µî ·Ï" name="write"> </FORM> 3.1.3. ÀÚ·á½Ç ÀÚ·á ¿Ã¸®±â(FileMan - Write_ok.asp) <% Set objFileMan = Server.CreateObject("FileMan.FileUpLoad") strDirectory = "C:\Inetpub\wwwroot\download\" ' ÆÄÀÏÀÌ ¿Ã·ÁÁú °æ·Î(strDirectory)¸¦ ÁöÁ¤... attach_file = TRIM(objFileMan.GetValueByName("FILE1")) 'ÈÀÏÀº attach_file º¯¼ö¿¡ ÀúÀåµË´Ï´Ù. 'filemanÀº °´Ã¼.GetValueByName ¼Ó¼ºÀ» ÀÌ¿ëÇØ °´Ã¼¸¦ ÀúÀåÇÕ´Ï´Ù. Set Gdb = Server.CreateObject("ADODB.Connection") Gdb.Open ("dsn=polcomm;uid=sa;pwd=;database="&dbname) GSQL = "Select MAX(num) from "& tname & " " Set GGrs = Server.CreateObject("ADODB.Recordset") GGrs.Open GSQL,Gdb If IsNULL(GGrs(0)) Then num=1 else num=GGrs(0)+1 End If 'num¿¡ °¡Àå Å«°ªÀ» ³Ö¾îÁÝ´Ï´Ù. If (attach_file="") Then attach_count=0 Else attach_count=1 End If 'ÁöÁ¤µÈ ÆÄÀÏÀÌ ¾øÀ¸¸é, attach_count=0ÀÌ, ÆÄÀÏÀÌ ÁöÁ¤µÇ¾î ÀÖ´Ù¸é 1ÀÌ ¼ÂÆõ˴ϴÙ. upsucc=1 if attach_count=0 Then filename="¾øÀ½" nLen="0" Else filename = Mid(attach_file, InstrRev(attach_file, "\") + 1) strFileName = strDirectory & filename on error resume next '--- ÆÄÀÏ ÀúÀå strRet = objFileMan.SaveFile("FILE1", CStr(strFileName)) if strRet="" then upsucc= 0 Else objFileMan.GetFileContent "FILE1", "", nLen, "" End If ' ÈÀϾ²±â¿¡ ½ÇÆи¦ Çϸé upsucc¿¡ 0°ªÀÌ µé¾î°¡±¸, ±×렆Áö ¾ÊÀ¸¸é 1°ªÀÌ µé¾î °©´Ï´Ù. ' ±×¸®±¸, ¸¸¾à ÆÄÀϸíÀÌ °æ·Î¿¡ Á¸ÀçÇÑ´Ù¸é, (if upsucc=0 then) À̸é Á¸ÀçÇÑ´Ù´Â ¸Þ½ÃÁö¸¦ ' ±×·¸Áö ¾ÊÀ¸¸é µ¥ÀÌÅͺ£À̽º¿¡ ³»¿ëÀ» ÀúÀåÇÏ¸é µÉ °ÍÀÌ´Ù. end if if upsucc=0 then response.write "ÆÄÀÏÀ̸§ÀÌ ÀÌ¹Ì Á¸ÀçÇÕ´Ï´Ù." else file_name = filename file_size = nLen name = objFileMan.GetValueByName("name") content = replace(content,"&","&") content = replace(content,"<","<") content = replace(content,">",">") SQL = "INSERT INTO databank (num,file_name,file_size,title,content,writeday,readnum,writer) VALUES " SQL = SQL & "( "& num & " ,'" & file_name & "','" & file_size & "','" & content & "',0,'" & writer & "') " Gdb.Execute SQL %> 3.1.4. ÀÚ·á½Ç ÀÚ·á ¿Ã¸®±â(SiteGalaxy - Write_ok.asp) <% set db=Server.CreateObject("ADODB.Connection") db.open("dsn=cak0280;uid=sa;pwd=;") set UploadForm=Server.CreateObject("SiteGalaxyUpload.Form") title=UploadForm("title") file1=UploadForm("file1") file2=UploadForm("file2") set FSO=Server.CreateObject("Scripting.FileSystemObject") if Len(file1)>0 then 'ÆÄÀÏÀ̸§ÀÌ Á¸ÀçÇϸé ó¸®ÇÑ´Ù. strDir="c:\inetpub\wwwroot\test\" '¼¹ö³» ÆÄÀÏÀÌ ÀúÀåµÇ´Â À§Ä¡ att_file=UploadForm("file1").filepath ' ÀúÀåµÉ ÆÄÀÏÀÇ À̸§À» ¾ò´Â´Ù. filesize1=UploadForm("file1").size ' ÀúÀåµÉ ÆÄÀÏÀÇ Å©±â¸¦ ¾ò´Â´Ù. if filesize1<2000000 then ' ÆÄÀÏ¿ë·®À» Á¦ÇÑÇÒ¼ö ÀÖ½À´Ï´Ù. filename1=mid(att_file, InstrRev(att_file,"\")+1) 'ÆÄÀϸíÀ» ¾ò´Â´Ù. strname=Mid(filename1, 1, Instr(filename1,".")-1) 'È®ÀåÀÚ¸¦ »« ÆÄÀϸíÀ» ¾ò´Â´Ù. strExt=Mid(filename1,Instr(filename1,".")+1) 'È®ÀåÀÚ¸¦ ¾ò´Â´Ù. bExist=True ' ¸ÕÀú °°Àº À̸§ÀÌ Á¸ÀçÇÑ´Ù´Â °¡Á¤ÇÏ¿¡ ÀÛ¾÷ ½ÃÀÛÇÕ´Ï´Ù. strfilename = strDir & strname & "." & strExt 'ÀúÀåµÉ ÆÄÀÏÀ» ¸¸µì´Ï´Ù. cntFilename = 0 ' ÆÄÀÏÀÌ Á¸ÀçÇÒ °æ¿ì À̸§µÚ¿¡ ºÙÀÏ ¼ýÀÚ¸¦ ¼ÂÆÃÇÕ´Ï´Ù. do while bExist ' °°Àº ÆÄÀÏÀÌ ¾øÀ» ¶§±îÁö ¹Ýº¹Ã³¸®, if (FSO.FileExists(strfilename)) then '°°Àº ÆÄÀÏÀÌ Á¸ÀçÇÏ´ÂÁö üũ cntfilename=cntfilename+1 filename1=strname&"_"&cntfilename&"."&strExt 'ÆÄÀϸíÀÌ Á¸ÀçÇÒ °æ¿ì _1,_2 µîÀ¸·Î ÆÄÀÏÀ̸§À» »ý¼º strfilename=strDir&filename1 else '°°Àº ÆÄÀÏÀÌ ¾øÀ» ¶§ bExist=false end if loop UploadForm("file1").SaveAs strfilename '½ÇÁ¦ ¼¹ö¿¡ ÀúÀåÇÕ´Ï´Ù. else response.write "ÈÀÏÀÇ ¿ë·®ÀÌ ³Ê¹« Å®´Ï´Ù. end if end if set Fso=nothing set UploadForm=Nothing ÀÌÇÏ´Â title,filename1,filesize1,filename2,filesize2¸¦ ÀúÀåÇÏ¸é µË´Ï´Ù. //---------------------------------------------------------------------- ¾ó¸¶³ª ÀÌÇØ°¡ °¡¼Ì´ÂÁö ¸ð¸£°Ú½À´Ï´Ù....... ÆÄÀÏÀÌ 2°³°¡ µÇµç, 20°³°¡ µÇµç,, °°Àº ÀÛ¾÷À» ¹Ýº¹À¸·Î »ç¿ëÇÏ¸é µÈ´ä´Ï´Ù.... ±×·³, ¿©·¯ºÐµµ ¼º°øÇÏ½Ã±æ ¹Ù¶ø´Ï´Ù. Âü,,, write.asp ¿¡¼ enctypeÀº ¹Ýµå½Ã ´ë¹®ÀÚ·Î ¾²¼Å¾ß ÇÕ´Ï´Ù.
|