20260907 :: 김현정 > 260824 PMS 개선 요청_경영문화본부 4차 반영
This commit is contained in:
83
ess/doc_attach_del.asp
Normal file
83
ess/doc_attach_del.asp
Normal file
@@ -0,0 +1,83 @@
|
||||
<!-- #include virtual = "lib/config.asp" -->
|
||||
<%
|
||||
Response.CharSet = "euc-kr"
|
||||
Response.AddHeader "Pragma","no-cache"
|
||||
Response.Expires = -1
|
||||
|
||||
Dim attachClientIp
|
||||
attachClientIp = Replace(Replace(Trim(Request.ServerVariables("REMOTE_ADDR")), "10.10.20.", "10.10.13."), "10.10.17.", "10.10.13.")
|
||||
|
||||
If attachClientIp <> "10.10.13.47" And _
|
||||
attachClientIp <> "10.10.13.105" And _
|
||||
attachClientIp <> "10.10.13.48" And _
|
||||
attachClientIp <> "10.10.13.6" And _
|
||||
attachClientIp <> "10.10.13.29" Then
|
||||
Response.Write "{""result"":""denied""}"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
Dim fso, krc_no, delIdx, folderPath, i, writePos
|
||||
Dim folderObj, oneFile, us, dt, idxPart, srcName, extPart
|
||||
Dim fileMap(20)
|
||||
|
||||
krc_no = Request.Form("krc_no")
|
||||
|
||||
If krc_no = "" Or InStr(krc_no, "..") > 0 Or InStr(krc_no, "/") > 0 Or InStr(krc_no, "\") > 0 Then
|
||||
Response.Write "{""result"":""fail""}"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Not IsNumeric(Request.Form("idx")) Then
|
||||
Response.Write "{""result"":""fail""}"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
delIdx = CInt(Request.Form("idx"))
|
||||
|
||||
If delIdx < 1 Or delIdx > 20 Then
|
||||
Response.Write "{""result"":""fail""}"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
Set fso = Server.CreateObject("Scripting.FileSystemObject")
|
||||
folderPath = Server.Mappath("/") & "/Upload/DOC_ATTACH/" & krc_no
|
||||
|
||||
If fso.FolderExists(folderPath) = False Then
|
||||
Response.Write "{""result"":""ok""}"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
Set folderObj = fso.GetFolder(folderPath)
|
||||
For Each oneFile In folderObj.Files
|
||||
us = InStrRev(oneFile.Name, "_")
|
||||
dt = InStrRev(oneFile.Name, ".")
|
||||
If us > 0 And dt > us Then
|
||||
idxPart = Mid(oneFile.Name, us + 1, dt - us - 1)
|
||||
If IsNumeric(idxPart) Then
|
||||
If CInt(idxPart) >= 1 And CInt(idxPart) <= 20 Then
|
||||
fileMap(CInt(idxPart)) = oneFile.Name
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If fileMap(delIdx) <> "" Then
|
||||
fso.DeleteFile folderPath & "/" & fileMap(delIdx)
|
||||
fileMap(delIdx) = ""
|
||||
End If
|
||||
|
||||
' close the numbering gap, preserving each remaining file's own extension
|
||||
writePos = delIdx
|
||||
For i = delIdx + 1 To 20
|
||||
If fileMap(i) <> "" Then
|
||||
srcName = fileMap(i)
|
||||
extPart = Mid(srcName, InStrRev(srcName, "."))
|
||||
fso.MoveFile folderPath & "/" & srcName, folderPath & "/" & krc_no & "_" & CStr(writePos) & extPart
|
||||
writePos = writePos + 1
|
||||
End If
|
||||
Next
|
||||
|
||||
Response.Write "{""result"":""ok""}"
|
||||
|
||||
Set fso = Nothing
|
||||
%>
|
||||
Reference in New Issue
Block a user