104 lines
2.3 KiB
Plaintext
104 lines
2.3 KiB
Plaintext
<!--#include virtual="/common/lib/dbcon.asp"-->
|
|
<!--#include virtual="/common/lib/func.asp"-->
|
|
<%
|
|
Server.ScriptTimeout=10000'-엑셀데이터의 원활한 처리를 위해 타임아웃 설정
|
|
Set objApp = nothing
|
|
|
|
Set uploadform = Server.CreateObject("DEXT.FileUpload")
|
|
uploadform.DefaultPath = server.MapPath("./")
|
|
'--업로드컴포넌트를 이용해 엑셀파일을 받아오는 부분
|
|
|
|
|
|
If uploadform("csvfile") <> "" Then
|
|
|
|
'------------파일 저장--------------------
|
|
strName = uploadform("csvfile").FileName
|
|
ext_arr = Split(strName,".")
|
|
|
|
Select Case UCase(ext_arr(UBound(ext_arr)))
|
|
Case "CSV", "TXT"
|
|
Case Else
|
|
Set uploadform = Nothing
|
|
alertMsg "유효한파일이 아닙니다."
|
|
response.end
|
|
End select
|
|
|
|
strDirectory = server.MapPath("/")&"\data\csv\"
|
|
strName = wfile2("csvfile", 10, strDirectory, "csv,txt")
|
|
|
|
|
|
'------------파일 저장--------------------
|
|
|
|
alertMsg("[추가완료] 메세지가 나올때까지 기다리세요.")
|
|
|
|
'------------전화번호 추가----------------
|
|
Set fs = Server.CreateObject("Scripting.FileSystemObject")
|
|
Set objFile = fs.OpenTextFile(strDirectory & strName, 1)
|
|
|
|
%>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
|
|
<%
|
|
i = 1
|
|
Do Until objFile.AtEndOfStream
|
|
|
|
if i = 1000 then
|
|
'1000건 넘어가면 경고메세지!!
|
|
%>
|
|
if(confirm("1000건 이상의 전송은 시간이 오래 걸리거나 중단될 수 있습니다.\n\n계속하시겠습니까?")){
|
|
<%
|
|
end if
|
|
|
|
number = phoneValue( objFile.readLine )
|
|
'response.write "//" & number & vbcrlf
|
|
if number <> "--" and number <> "" then
|
|
%>
|
|
parent.add_input2("<%=number%>");
|
|
<%
|
|
end if
|
|
i = i + 1
|
|
loop
|
|
|
|
'1000건 이상이면 alert창을 띄울것이므로 닫기'}'도 해준다.
|
|
if i >= 1000 then
|
|
response.write "}"
|
|
end if
|
|
%>
|
|
|
|
parent.document.getElementById("csvfile").value = "";
|
|
parent.closeArea();
|
|
|
|
//-->
|
|
</SCRIPT>
|
|
|
|
<%
|
|
|
|
Set fs = Nothing
|
|
Set objFile = nothing
|
|
'------------전화번호 추가끝--------------
|
|
|
|
'------------파일삭제---------------------
|
|
dfile strDirectory , strName
|
|
'------------파일삭제---------------------
|
|
alertMsg("추가완료")
|
|
response.end
|
|
Else
|
|
Set uploadform = nothing
|
|
End If
|
|
|
|
|
|
|
|
'----------함수--------
|
|
|
|
Function alertMsg(msg)
|
|
%>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
alert("<%=msg%>");
|
|
//-->
|
|
</SCRIPT>
|
|
<%
|
|
End Function
|
|
|
|
%> |