Files
KIN/management/personnel_card_img_ajax.asp
2025-09-29 17:55:08 +09:00

52 lines
1.5 KiB
Plaintext

<!-- #include virtual = "lib/config.asp" -->
<%
Response.CharSet = "EUC-KR" 'ÇѱÛ
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-control", "no-staff"
Response.Expires = -1
set uploadform = Server.CreateObject("DEXT.FileUpload")
set fs = Server.CreateObject("Scripting.FileSystemObject")
uploadform.AutoMakeFolder = True
dim FilePath, Ext, ImgChk
dim ImgName : ImgName = uploadform("img_name")
dim ImgFile : ImgFile = uploadform("img_file")
ImgChk = uploadform("ImgChk")
uploadform.DefaultPath = Server.MapPath("/images/management/img")
Ext = Mid(ImgFile, InStrRev(ImgFile, "."))
ImgName = ImgName&Ext
FilePath = uploadform.DefaultPath & "\" & ImgName
If fs.FileExists(FilePath) Then
Call rename(FilePath, "bak_" & date_time() & "_"+ImgName)
End If
uploadform("img_file").saveAs(FilePath)
ImgChk = "1"
Response.Write ImgChk
set uploadform = nothing
function rename(oldname,newname)
dim f
set f=server.createobject("scripting.filesystemobject").getfile(oldname)
f.name=newname
set f=nothing
end function
Function date_time()
v_year = year(date)
v_month = month(date)
if v_month < 10 then v_month = "0" & v_month
v_day = day(date)
if v_day < 10 then v_day = "0" & v_day
v_hour = hour(time)
if v_hour < 10 then v_hour = "0" & v_hour
v_minute = minute(time)
if v_minute < 10 then v_minute = "0" & v_minute
v_second = second(time)
if v_second < 10 then v_second = "0" & v_second
v_datetime = v_year&v_month&v_day&v_hour&v_minute&v_second
date_time = v_datetime
End Function
%>