Upload | no component | application Example | upload | no component | application example
"'--------upload.htm-------------
<script language= "JavaScript" >
function Checkfile (myForm)
{
if (myform.file1.value== ') return false;
Myform.submit ();
}
</script>
<form method= "POST" name= "UPL" action= "fjupload.asp" enctype= "Multipart/form-data" >
<input type= "File" Name= "File1" id= "File1" >
<input type= "button" Name= "Upfiles" value= "Upload" >
</form>
"'------------fjupload.asp-----------------
<!--#include file= ". /.. /inc/config.asp "-->
<!--#include file= ". /.. /inc/upload.inc "-->
<%
Founderr=false
Savepath = Server.MapPath ("?????") ' Directory where uploaded files are stored
Call Upload_0 () ' Use transformation no component upload class
' Upload Program
Sub Upload_0 () ' Use transformation no component upload class
Set upload=new upload_file ' Build upload Object
Dim msg ' Stores error messages that occur during upload
Dim FileCount ' Total number of files stored
Dim Upcount ' Stores The total number of uploaded files
Filecount=0
Upcount=0
For every formName in Upload.file ' lists all uploaded files
Set File=upload.file (formName) ' generates a File object
if (file.filename<> "") Then
Founderr=false
Filecount=filecount +1
Set File=upload.file (formName) ' generates a File object
Randomize
Rannum=int (900*RND) +100
Last_fn=hour (now ()) & Minute (now ()) & Second (now ()) & Rannum ' generates a random number appended to the end of the file to prevent file name collisions
Ext_fn=file.fileext ' name extension
Filename=savepath & "\" & File.smallfilename & "_" & LAST_FN
If ext_fn<> "" Then Filename=filename & "." & EXT_FN
If FSO. FileExists (filename) Then
Msg=msg & "\ r \ n" & file.filename & "File already exists, please change file name"
Founderr=true
End If
' If you can upload it, do the upload
If Founderr<>true Then
File. SaveToFile filename ' Save file
if (err=0) then
Upcount = Upcount + 1
Msg=msg & "\ r \ n" & File.filename & "Upload success!" "
' If it is a RAR file for decompression
if (LCase (file.fileext) = "rar") Then
Call Uncompess (Filename,savepath) ' uncompressed
End If
Else
Msg=msg & "\ r \ n" & file.filename & "Upload failed!" "
End If
End If
End If
Set file=nothing
Next
Set fso=nothing
Set upload=nothing
' If the number of files uploaded successfully is less than the number of uploaded files, the error prompts
If