아직 asp upload 라 는 구성 요소 가 없 는 것 을 발 견 했 습 니 다.이 두 가지 기능 의 해결 방안 은 제 개선 방안 을 여기에 쓰 겠 습 니 다!감사합니다. ASupload 업로드 구성 요소,파일 이름 바 꾸 기,진도 항목 에 대한 문제 해결 방안! 각각 1.asp,2.asp,bar.asp,framebar.asp 등 4 개의 파일 을 공유 합 니 다. 첫 번 째 파일 실행:1.asp,업로드 작업 실행!
<%
'''
dim SPid,PID,barref
Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
SPid = UploadProgress.CreateProgressID()
PID = "PID=" & SPid
barref = "framebar.asp?to=10&" & PID
%>
<SCRIPT language="javascript">
<!--
function ShowProgress()
//
{
strAppVersion = navigator.appVersion;
if (document.upfile.filename.value != "")
{
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=375px; dialogHeight:175px; center:yes;status:no";
window.showModelessDialog('<% = barref %>&b=IE',window,winstyle);
}
else
{
window.open('<% = barref %>&b=NN','','width=370,height=165', true);
}
}
return true;
}
function isPic(){
var temp;
var ExtList = ".jpg.gif.bmp.png.swf";// , , , !
var filename = upfile.filename.value;
var the_ext = filename.substr(filename.lastIndexOf(".")+1).toLowerCase();
if (ExtList.indexOf(the_ext)==-1){
alert(" , !");
return false;
}
return true;
}
//-->
</SCRIPT>
<html>
<head></head>
<body>
<form method="post"enctype="multipart/form-data"action="2.asp?<% = PID %>"name="upfile"OnSubmit="return ShowProgress();">
:<br>
<input type=file name="filename"><br>
<input type=submit value=" " onclick="return isPic()">
</form>
</body>
</html>
2.asp
<%
Set Upload = Server.CreateObject("Persits.Upload")
' Prevent overwriting
Upload.OverwriteFiles = False
' We use memory uploads, , :b
Upload.SetMaxSize 1*1024*1024*1024, true
if Request.QueryString("PID") = "" then
Upload.ProgressID="010D60EB00C5AA4B"
else
Upload.ProgressID=Request.QueryString("PID")
end if
On Error Resume Next
' Save to memory
Upload.Save
If Err.Number = 8 Then
Response.Write " 1G"
End If
' , + ,
Dim ranNum
randomize
ranNum=int(999*rnd)
CreateName=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
NewName = CreateName
'
articlepath = Server.MapPath("upload1")
For Each File in Upload.Files
FileExt=Lcase(replace(File.ext,".",""))
' ,
If CheckFileExt(FileExt)=false then
Response.write " , [ <a href=# onclick=history.go(-1)> </a> ]"
else
File.SaveAs articlepath & "/" & NewName & File.ext
Response.Write "New name: " & File.FileName & "<BR>"
End If
Next
%>
<%
' ,
Private Function CheckFileExt(FileExt)
If FileExt="" or IsEmpty(FileExt) Then
CheckFileExt=false
Exit Function
End If
If Lcase(FileExt)="asp" or Lcase(FileExt)="asa" or Lcase(FileExt)="aspx" then
CheckFileExt=false
Exit Function
End If
If Lcase(FileExt)="gif" or Lcase(FileExt)="jpg" or Lcase(FileExt)="png" or Lcase(FileExt)="swf" or Lcase(FileExt)="bmp" then
CheckFileExt=true
Exit Function
Else
CheckFileExt=false
End If
End Function
%>
1
2 다음 페이지 전문 을 읽다