+++ ȨÁ¦ÀÛ ¹ÙÀ̺í +++
ȨÁ¦ÀÛ ¹ÙÀ̺í ÀÌ »çÀÌÆ®´Â ÀÌ¿µÂù´ÔÀÇ »çÀÌÆ®¸¦ º¹¿øÇÑ °ÍÀÔ´Ï´Ù.
Untitled Document
Html
Dhtml
Css
Php
Asp
Cgi
Java Script
Java Applet
Multimedia
Win Tip
ÆÄÀϾ÷·Îµå½Ã Áߺ¹ÆÄÀÏ Ã³¸®
ABCUpload ÄÄÆ÷³ÍÆ®¸¦ ÀÌ¿ëÇÏ¿© ÆÄÀÏÀ» ¾÷·Îµå ½Ãų¶§ ÁöÁ¤µÈ Æú´õ¿¡ ¾÷·Îµå½Ãų ÆÄÀÏÀÌ Á¸ÀçÇÏ¸é ¿¡·¯°¡ ¹ß»ýÇÕ´Ï´Ù.

ÀÌ·² °æ¿ì Áߺ¹µÈ ÆÄÀÏÀ» ¾÷·Îµå½Ãų¶§´Â ¸ÕÀú ÆÄÀÏÀÌ ÀÖ´ÂÁö ¾ø´ÂÁö °Ë»çÇؼ­ ¾øÀ¸¸é ±×³É ¾÷·Îµå ½ÃÅ°°í ÀÖÀ¸¸é »õ·Ó°Ô ¿Ã¸®´Â ÆÄÀÏÀ̸§³¡¿¡ ¹øÈ£¸¦ ºÎ¿©Çؼ­ ¾÷·Îµå ½ÃÅ°´Â ¹æ¹ýÀÔ´Ï´Ù.

ÀÌ°ÍÀº FileSystemObjecet ¸¦ ÀÌ¿ëÇÏ¿© ±¸ÇöÇÕ´Ï´Ù. ´ÙÀ½Àº ±× »ç¿ë¿¹Á¦ ÀÔ´Ï´Ù.

¸ÕÀú ÆÄÀÏÀ» ¾÷·Îµå½ÃÅ°´Â È­¸éÀ» Ãâ·Â½ÃÅ°´Â upload.html ¹®¼­ÀÔ´Ï´Ù.

<html>
<body>
<form method="post" action="dbupload.asp" enctype="multipart/form-data">
<input type="file" name="file"><br>
<input type="submit" name="submit" value="submit">
</form>
<body>
</html>


½ÇÁ¦·Î ¾÷·Îµå ½ÃÅ°´Â dbupload.asp ¹®¼­´Â ´ÙÀ½°ú °°½À´Ï´Ù.

<%

Set theForm = Server.CreateObject("ABCUpload4.XForm")
Set theField = theForm("file")(1)

If theField.FileExists Then

    filedir = "./dirupload/"
    filename = theField.SafeFileName
    filepath = filedir & theField.SafeFileName
    filesize = theField.Length
    
    Set objFS = Server.CreateObject("Scripting.FileSystemObject")
    fExist = TRUE
    fCount = 0
    Do while fExist
        If (objFS.FileExists(server.mappath(filepath))) Then
            fCount = CInt(fCount)+1
            filename1 = Mid(filename,1,Instr(filename,".")-1) ' ¼ø¼öÈ­ÀÏÀ̸§±¸Çϱâ
            filename2 = Mid(filename,Instr(filename,".")+1) ' È®Àå¸í±¸Çϱâ
            filename3 = filename1 & fCount & "." & filename2 ' Ä«¿îÆÃµÈ ÆÄÀÏÀ̸§
            filepath = filedir & filename3
        else
            fExist = FALSE
         end if
    Loop
    Set objFS = nothing

    theField.Save filepath
    
    Set theForm = nothing
    Set theField = nothing    

    Response.Write "file uploaded .. "

End If

%>
Update : 2001/06/12 [µ¹¾Æ°¡±â]