first commit
This commit is contained in:
61
include/File_Upload.asp
Normal file
61
include/File_Upload.asp
Normal file
@@ -0,0 +1,61 @@
|
||||
<!-- #include Virtual = "/Lib/aspJSON1.17.asp" -->
|
||||
<!-- #include Virtual = "/Lib/JSON_2.0.4.asp" -->
|
||||
<!-- #include Virtual = "/Lib/JSON_UTIL_0.1.1.asp" -->
|
||||
<%
|
||||
Server.ScriptTimeout= 60 * 10
|
||||
Dim JSON
|
||||
|
||||
Dim c_jsonText
|
||||
|
||||
set uploadform = Server.CreateObject("DEXT.FileUpload")
|
||||
uploadform.AutoMakeFolder = True
|
||||
Dim PKEY : PKEY = uploadform("PKEY")(1)
|
||||
Dim IDKEY : IDKEY = uploadform("IDKEY")(1)
|
||||
Dim VAR : VAR = uploadform("VAR")(1)
|
||||
uploadform.DefaultPath = Server.MapPath("/ProjectUpload") & "\" & PKEY & "\" & IDKEY & "\" & VAR
|
||||
|
||||
|
||||
file_cnt = uploadform("file_num").count
|
||||
|
||||
Redim j_cnt(file_cnt-1)
|
||||
|
||||
For i = 1 to file_cnt
|
||||
IDKEY = uploadform("IDKEY")(i)
|
||||
File_Name = uploadform("file_name")(i)'원본 File Name
|
||||
File_Ext = Mid(File_Name, InStrRev(File_Name, "."))'원본 file 확장자
|
||||
|
||||
File_new_Name = IDKEY & "_" & VAR & "_" & uploadform("file_num")(i) & File_Ext 'New File name
|
||||
File_Path = uploadform.DefaultPath & "\" & File_new_Name 'File save root
|
||||
File_ori_name = File_Name
|
||||
|
||||
If uploadform.FileExists(File_Path) Then
|
||||
File_Name_Only = IDKEY & "_" & VAR & "_" & uploadform("file_num")(i)
|
||||
t = 0
|
||||
Do While (1)
|
||||
File_Path = uploadform.DefaultPath & "\" & File_Name_Only & "_" & t & File_Ext
|
||||
If Not uploadform.FileExists(File_Path) Then Exit Do
|
||||
t = t + 1
|
||||
Loop
|
||||
File_new_Name = File_Name_Only & "_" & t & File_Ext 'Not duplicated file name'
|
||||
End If
|
||||
|
||||
uploadform("file_name")(i).SaveAs(File_Path)
|
||||
|
||||
set c_jsonText = jsObject()
|
||||
c_jsonText("File_No") = i-1
|
||||
c_jsonText("File_new_Name") = File_new_Name
|
||||
c_jsonText("File_ori_Name") = File_ori_name
|
||||
c_jsonText("File_Ext") = File_Ext
|
||||
set j_cnt(i-1) = c_jsonText
|
||||
NEXT
|
||||
|
||||
set JSON = jsObject()
|
||||
json("count") = Ubound(j_cnt)
|
||||
json("file_data") = j_cnt
|
||||
|
||||
Response.Write toJSON(JSON)
|
||||
set uploadform = nothing
|
||||
|
||||
|
||||
|
||||
%>
|
||||
Reference in New Issue
Block a user