<html> <head><title>ÆÄÀÏ ¾÷·Îµå</title></head> <body> <center> <h1>ÆÄÀÏ ¾÷·Îµå</h1> <hr> <form method=post action=upload.asp enctype="multipart/form-data"> <table border=0 align=center> <tr> <td> Á¦¸ñ : </td> <td><input type=text name=title size=30></td> </tr> <tr> <td colspan=2>¼³¸í : <br> <textarea name=content rows=10 cols=50 ></textarea></td> </tr> <tr> <td colspan=2><input type=file name=upfile value="°Ë»ö..."></td> </tr> <tr> <td colspan=2><input type=submit value="ÆÄÀÏ ¾÷·Îµå"></td> </tr> </table> </form> </center> </body> </html>
if UploadForm("title") <> "" then set userinfo = server.createobject("ADODB.Connection") userinfo.open session("dsn") upfile = UploadForm("upfile") subject = UploadForm("title") textdata = UploadForm("content")
if Len(upfile) > 0 then set fs = CreateObject("Scripting.FileSystemObject")
' ÇØ´çÆú´õÀÇ ÇÏÀ§Æú´õ upfiles¶ó´Â Æú´õ¿¡ ÀÚ·á½ÇÀ» ¿î¿µ
fsdir = server.mappath(".") & "\upfiles\" filedir = UploadForm("upfile").filepath filename = mid(filedir, instrrev(filedir,"\")+1) filename1 = mid(filename,1,instrrev(filename,".")-1) filename2 = mid(filename,instrrev(filename,".")+1)
addfile = fsdir & filename
fexist = true count = 0
'ÆÄÀÏÀÌ ÀÌ¹Ì ÀÖÀ»¶§
do while fexist if(fs.fileexists(addfile)) then count = count + 1 filename = filename1 & "-" & count & "." & filename2 addfile = fsdir & filename else fexist=false end if loop
UploadForm("upfile").saveas addfile set fs=nothing
end if
if upfile = "" then filesize=0 filename="" end if
'----------- ÆÄÀÏ ¾÷·Îµå ±â´É ---------------
userinfo.execute("insert into board values ('"subject & "','" & _ textdata & "','" & _ filename & "',0)")
userinfo.close set userinfo=nothing
response.redirect "boardlist.asp"