Found that there is no aspupload of this component, the two functions of the solution, now my Improvement Program is written here! Thank you.
About AspUpload upload components, file renaming, progress bar problem solving solution!
A total of 4 files, respectively, are 1.asp,2.asp,bar.asp,framebar.asp
Run the first file: 1.asp, perform the upload operation!
Copy Code code as follows:
<%
"" Progress bar
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 ()
Load progress bar
{
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";//client, detect file suffix name, save upload completed, only reported file type Error!
var filename = upfile.filename.value;
var the_ext = filename.substr (Filename.lastindexof (".") +1). toLowerCase ();
if (Extlist.indexof (the_ext) ==-1) {
Alert ("Not a picture, please choose a picture File!") ");
return false;
}
return true;
}
-->
</SCRIPT>
<body>
<form method= "POST" enctype= "Multipart/form-data action=" 2.asp?<% = PID%> "name=" Upfile "OnSubmit=" return ShowProgress (); " >
Select the file to upload:<br>
<input type=file name= "filename" ><br>
<input type=submit value= "upload" onclick= "return Ispic ()" >
</form>
</body>
2.asp
Copy Code code as follows:
<%
Set Upload = Server.CreateObject ("Persits.upload")
' Prevent overwriting
Upload.overwritefiles = False
' We use memory uploads, file size limit, Unit: 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 saved to memory
Upload.Save
If Err.Number = 8 Then
Response.Write "File is greater than 1G"
End If
' To make the file not duplicate, use system time + random number, as filename
Dim Rannum
Randomize
Rannum=int (999*RND)
Createname=year (now) &month (now), &day (now), &hour (now) &minute (now) &second
NewName = Createname
' Save file path
Articlepath = Server.MapPath ("Upload1")
For each File in Upload.files
Fileext=lcase (replace (File.ext, ".", ""))
' Server-side judgment file type, dynamic network forum judgment Way
If Checkfileext (fileext) =false Then
Response.Write "file format is incorrect or cannot be empty [<a href=# onclick=history.go ( -1) > re-upload </a>]"
Else
File.saveas Articlepath & "/" & NewName & File.ext
Response.Write "New Name:" & File.filename & "<BR>"
End If
Next
%>
<%
' Server-side judgment file type, dynamic network forum judgment Way
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
%>
current 1/2 page
1 2 Next read the full text