<%
Set Up = Server.CreateObject("SiteGalaxyUpload.Form")
Path1 = server.mappath(".") & "\upload\"
|
| Fname = Up("file1") |
if Fname <> "" then // ÆÄÀÏ Ã·ºÎ°¡ µÇ¾úÀ¸¸é
if Up("file1").Size > 10240 then // ¿ë·®Á¦ÇÑ
Response.Write "¿ë·®Ãʰú"
Response.End
end if |
if Up("file1").MimeType <> "image" then // À̹ÌÁö ¾÷·Îµå Çã¿ë
Response.Write "À̹ÌÁö ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù."
Response.End
end if |
| Filename=Mid(Fname,InstrRev(Fname,"\")+1) // ÆÄÀÏÀ̸§ºÎºÐ ÃßÃâ |
// ÆÄÀÏÀ̸§¿¡¼ ¼¼¹ÌÄÝ·Ð(;)ÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»çÇÑ´Ù
if NOT(InStr(Filename,";" ) Then
response.write "<script>alert(`¾÷·Îµå ±ÝÁö ÆÄÀÏÀÔ´Ï´Ù`);history.back()</script>"
response.End
End if |
|
// Áߺ¹½Ã¿¡ ÆÄÀÏÀ̸§ ºÎºÐÀ» º¯°æÇϱâ À§ÇØ ºÐ¸®¸¦ ÇÑ´Ù
Farry=split(Filename,".") // .À» ±âÁØÀ¸·Î ºÐ¸® |
preFname=Farry(0) // ÆÄÀÏÀ̸§ ¾ÕºÎºÐ
extFname=Farry(UBound(Farry)) // ÆÄÀÏÀ̸§ÀÇ ¸¶Áö¸· È®ÀåÀÚ |
// ÆÄÀÏÀ̸§ÀÇ ¸¶Áö¸· È®ÀåÀÚ¸¦ °Ë»çÇÑ´Ù
if (NOT(extFname <> "jpg") or (extFname <> "hwp") or (extFname <> "pdf")) then
response.write "¾÷·Îµå ±ÝÁö ÆÄÀÏ ÀÔ´Ï´Ù"
response.End
End If |
// ÀúÀåÇÒ Àüü path¸¦ ¸¸µç´Ù, ÆÄÀÏÀ̸§À» ¸¸µç´Ù
Path2 = Path1 & Filename
saveFname=preFname & "." & extFname |
Set fso = CreateObject("Scripting.FileSystemObject")
countNo = 0 // ÆÄÀÏ Áߺ¹µÉ°æ¿ì ¼ÂÆÃ °ª
fExist=0 // °°Àº À̸§ÀÇ ÆÄÀÏ Á¸Àç üũ
Do until fExist = 1
If(fso.FileExists(Path2)) Then
countNo = countNo + 1
Path2 = Path1 & preFname & countNo & "." & extFname
saveFname=preFname & countNo & "." & extFname
else
fExist=1
End If
Loop |
Up("file1").SaveAs(Path2)
response.write(saveFname & "ÀúÀå¿Ï·á")
else
response.write("Error")
end if |
Set Up = nothing
%> |