|
|
|
ûÇæÔñýѨ / 2002-04-01 / ¿ÀÈÄ 7:49:45 / 203.255.3.190
Á¶È¸¼ö : 145
|
[Áú¹®] DB¿¡ ÀÔ·ÂÀÌ ¾ÈµÇ³×¿ä..ÈÄ..< |
> ¿À·ù´Â ÇØ°áÇß¾î¿ä.. ±×·±µ¥ write.asp(±Û¿Ã¸®´ÂÆäÀÌÁö)¿¡¼ °ªÀÌ ¾È³Ñ¾î¿Í¿ä.
>
> write_test.asp ¼Ò½º :
>
> <%
> set UploadForm = server.CreateObject("SiteGalaxyUpload.Form")
>
> subject = UploadForm("subject") !!!!!!!!!! <- ¿©±â¿¡¼ uploadform("subject") ´ë½Å
> ±×³É subject = " Å×½ºÆ® " ÀÌ·¸°Ô ÇÏ¸é °ªÀÌ ÀԷµǿä.
> ±×·¯´Ï±î °ªÀ» ÀÔ·ÂÇÏ´Â ÀÌ ÆäÀÌÁöÀÇ ¼Ò½º¿£ ¹®Á¦°¡ ¾ø´Â °Í °°Àºµ¥ ¿Ö °ªÀÌ ¾È³Ñ¾î¿ÀÁÒ.
> ´ç¿¬È÷ write.asp¿¡¼
> <form action="write_test.asp" method="POST" onsubmit=" return CheckForm()" name=regform ENCTYPE="MULTIPART/FORM-DATA"> ·Î °ªÀ» ³Ñ±â´Â ºÎºÐµµ Á¤»óÀä.
>
> ¿Ö °ªÀÌ ¾È ³Ñ¾î¿À´Â°ÅÁÒ.. ´ÜÁö write_test¿¡¼ ÀÔ·ÂÇÑ visited, size, reg_date ¸¸ ÀÔ·ÂÀÌ µÇ³×¿ä.
> ±×·¯´Ï±î ÀÔ·ÂµÈ °ªÀ» º¸¿©ÁÖ´Â ¸ñ·ÏÆäÀÌÁö¿¡ º¸¸é visited¿Í reg_date¸¸
> °Ô½Ã°¡ µÇ³×¿ä......Àú ÀÌÁ¦ ¼ûÀÌ ³Ñ¾î°¥°Í¸¸ °°¾Æ¿ä....
>
> ¾î¶»°Ô ÇØ¾ß µÇ³ª¿©........
> °ªÀ» ÀÔ·ÂÇϴ°Ϳ¡ ¹®Á¦°¡ ¾ø´ÂµíÇØ¿ä. ±×·¯´Ï±î ³Ñ¾î¿Â °ªÀÌ ¾ø¾î¼ ±×·±°Í °°Àºµ¥ ¼Ò½º»ó´Üó·³ °ªÀ» ¹Þ¾Æ¼ º¯¼ö¿¡
> ÀúÀåÀ» Çߴµ¥ ¿Ö ÀúÀåÀÌ ¾ÈµÇ´Â°ÇÁö...
> response.write·Î Çѹø Ãâ·ÂÇØ ºÃ´õ´Ï Àú·¸°Ô ³ª¿À´Âµ¥¿ä..
>
> **************************** response¹® *********************88
> INSERT INTO pds0 ( Subject, Writer, Email, pdsFile, FileSize, Homepage, Content, Reg_Date, Visited, Passwd, Html) VALUES ('','','','','0','','', GetDate() ,0,'',0)
> ÀÀ´ä °³Ã¼ error 'ASP 0156 : 80004005'
>
> Çì´õ ¿À·ù
>
> /made_pds/write_test.asp, line 113
>
> ** line 113 : Response.redirect "list.asp?db=" & db
>
>
> Ŭ¶óÀ̾ðÆ® ºê¶ó¿ìÀú¿¡ HTTP Çì´õ°¡ ÀÌ¹Ì ¾²¿© ÀÖ½À´Ï´Ù. HTTP Çì´õ´Â ÆäÀÌÁö ÄÁÅÙÆ®¸¦ ¾²±â Àü¿¡¸¸ ¼öÁ¤ÇØ¾ß ÇÕ´Ï´Ù.
> ************************************ ³¡ ********************************
>
> db = uploadform("db")
> writer = uploadform("writer")
> email = UploadForm("email")
> homepage = UploadForm("homepage")
>
> passwd = UploadForm("passwd")
> content = UploadForm("content")
> pdsfile = UploadForm("pdsfile")
> visited = 0
> html = uploadform("html")
>
> if html = "on" then
> html = 1
> else
> html = 0
> end if
>
> subject = replace(subject,"'","'")
> content=replace(content,"'","'")
>
>
> '**********************************************************
> ' Upload File ÀÌ ÀÖÀ»¶§ÀÇ Ã³¸®
> '**********************************************************
>
> if len(pdsfile) > 0 then 'ÆÄÀÏÀÇ À̸§ÀÌ Á¸ÀçÇÒ°æ¿ì.....
> filesize=UploadForm("pdsfile").size 'ÆÄÀÏÀÇ Å©±â¸¦ ÀúÀå
> maxsize=Cint(20) * 1024
>
> set fc = createobject("Scripting.FileSystemObject") 'fs ¶ó´Â ÀνºÅϽº¸¦ »ý¼º
>
> storedir = server.MapPath (".\") & "\pds\" 'ÆÄÀÏÀÌ ÀúÀåµÉ Àý´ë°æ·Î¸¦ ¼³Á¤
> 'ex) storedir = "c:\pdsdata\"
> attach_file=UploadForm("pdsfile").filepath 'ÆÄÀÏÀÌ ÀúÀåµÉ °æ·Î¸¦ ÁöÁ¤
> pdsfile=mid(attach_file, instrrev(attach_file,"\")+1) '°æ·Î¸íÀ» Á¦¿ÜÇÑ ÆÄÀϸíÀ» ÃßÃâ
> strname=mid(pdsfile, 1, instrrev(pdsfile, ".")-1) ' file ¸í¿¡¼ À̸§°ú È®ÀåÀÚ¸¦ ºÐ¸®
> strext=mid(pdsfile, instrrev(pdsfile, ".")+1) 'È®ÀåÀÚ¸¦¾ò´Â´Ù
>
> strfilename = storedir & pdsfile ' ÀúÀåÇÒ À̸§ÀÇ Àüü path¸¦ ¸¸µì´Ï´Ù. ex) c:\inetpub\upload\write.asp
>
> fexist = true
> count = 0
>
> do while fexist ' ÆÄÀÏÀÌ Áߺ¹µÉ°æ¿ì À̸§À» ´Ù½Ã ÁöÁ¤ - ÆÄÀÏÀ̸§ µÚ¿¡ ¼ýÀÚ¸¦ ºÙ¿©¼ ¾÷·Îµå
> if(fc.FileExists(strfilename)) then
> count = count+1 'ÆÄÀÏÀ̸§¿¡ ¼ýÀÚ¸¦ ºÙÀÎ »õ·Î¿î ÆÄÀÏ À̸§ »ý¼º
> pdsfile = strname & "-" & count & "." & strext
> strfilename=storedir & pdsfile
> else
> fexist = false
> end if
>
> loop
> UploadForm("pdsfile").saveas strfilename ' ÄÞÆ÷³ÍÆ®¿¡ ÀÇÇØ ½ÇÁ¦ ÆÄÀÏÀ» ¾÷·Îµå
> end if
>
> '****************************************************
> ' Upload ÇÒ ÆÄÀÏÀÌ ¾øÀ»¶§ ÀûÀýÇÑ °ªÀ¸·Î ´ëü
> '****************************************************
> if pdsfile = "" then
> filesize = 0
> pdsfile = ""
> end if
>
> '*****************************************************
> ' file sizeº¯È¯
> '*****************************************************
>
> temp = clng(filesize)
> if temp > 1024 then '1024byte(1kbyte) º¸´Ù Å©¸é
> temp = temp / 1024
> filesize = cstr(cint(temp)) & "k"
> end if
>
> set dbcon = server.createobject("adodb.connection")
> with dbcon
> .provider="sqloledb"
> .connectionstring="server=(local);database=made;uid=made;pwd=made;"
> .connectiontimeout=10
> .open
> end with
>
> sql = " INSERT INTO " & db & " ( Subject, Writer, Email, pdsFile, FileSize, Homepage, Content, Reg_Date, "
> sql = sql & " Visited, Passwd, Html) VALUES "
> sql = sql & "('" & subject & "'"
> sql = sql & ",'" & Writer & "'"
> sql = sql & ",'" & Email & "'"
> sql = sql & ",'" & pdsfile & "'"
> sql = sql & ",'" & fileSize & "'"
> sql = sql & ",'" & Homepage & "'"
> sql = sql & ",'" & Content & "', GetDate() ," & Visited
> sql = sql & ",'" & Passwd & "'"
> sql = sql & "," & Html & ")"
>
> dbcon.execute sql
>
> ' µ¥ÀÌÅͺ£À̽º ¿¬°á ²÷±â
>
> dbcon.Close
> Set dbcon = Nothing
> set FSO = Nothing
> set UploadForm = nothing
>
> Response.redirect "list.asp?db=" & db
> ' ÀνºÅϽº¸¦ ¼Ò¸ê......
> %>
-----------------------------------------------------------
write_test.asp°¡ ¾Æ¹«·± ¹®Á¦°¡ ¾ø´Ù¸é
¹®Á¦´Â ´ç¿¬È÷ write.asp ÀÌ°ÚÁö¿ä...
write.asp¿¡¼ input µ¥ÀÌÅÍÀÇ À̸§ÀÌ Á¦´ë·Î ¸ÅÄ¡ µÇ¾ú´ÂÁö »ìÆì º¸¼¼¿ä.... |
|
|
|