If there is a component upload method, please right-click "FyUpload.sct" to register, and then you can use:
Server.CreateObject("Rimifon.Upload")
Create objects.
To upload components without components, please use GetObject("script:" + component address)
Create an object, the component address is the absolute path of the hard disk, or you can use the http full path.
==============================================
Property and method description:
Set the page character encoding: Upload.Charset = "UTF-8" //The default is gb2312 encoding.
File size limit: Upload.MaxSize = 1024 * 512 //Set the upload size to not exceed 512 kb. When the parameter is zero, there is no limit on the upload file size (default is 0).
File type restrictions: Upload.Filter = "rar|zip|txt|gif|jpg|bmp|htm|html|swf|mht"; //(Default value) Set the document types allowed to be uploaded. Use if there is no restriction on the uploaded file type. NULL value.
Get the client path of the uploaded file: Upload.Field.Input box name.FilePath
Get the file name of the uploaded file: Upload.Field.Input box name.SourceName
Get the file name saved after uploading the file: Upload.Field.Input box name.FileName
Get the MimeType of the uploaded file: Upload.Field.Input box name.FileType
Get the actual size of the uploaded file: Upload.Field.Input box name.FileSize
Get restricted information about uploaded files: Upload.Field.Input box name.Message
Obtain form data: Upload.Field.Input box name.Value //If it is a file, return the Unicode encoding content of the file. Specify the upload buffer size and read the upload data: Upload.ReadForm (buffer size [bytes], parameter two) //The default is all buffering, and it is recommended to be below 200k (which can solve the problem of not being able to upload large files in 2003); providing parameter two can generate Application data with a progress bar for uploading.
Save the file to the specified directory: Upload.SaveFile("Save Directory") //The default is the current directory
==============================================
Demo: http: //www.fengyun.org/Test/NetDiskThe
common demo code is as follows:
< %@language=javascript%><html><head >
<meta http-equiv="Content-Type" content="text/html;charset=gb2312">
<title>Fengyun JS upload component</title><%
var Upload,Info,undefined;
if(Request.ServerVariables("Request_Method") == "POST")
{
//Upload = Server.CreateObject("Rimifon.Upload");
Upload = GetObject("script:http://www.zope.org/Members/Rimifon/FyUpload.sct#Upload");
Upload.MaxSize = 1024 * 512;
Upload.ReadForm(204800);
Upload.SaveFile(".");
var field = new Array;
field.push("Documents allowed to be uploaded:" + (Upload.Filter?Upload.Filter:"All documents"));
field.push("Maximum size of a single file:" + (Upload.MaxSize?(Upload.MaxSize/1024/1024).toFixed(1)+" Mb":"No limit on file size"));
field.push("============================================== ===============");
for(var x in Upload.Field)
{
if(Upload.Field[x].FilePath)
{
field.push(x+":" + (Upload.Field[x].Message?
Upload.Field[x].FilePath+"(" + Upload.Field[x].Message + ")":
"<a target=_blank href=" + Upload.Field[x].FileName + ">" +
Upload.Field[x].FilePath + "</a> (" + Upload.Field[x].FileSize + " bytes)"));
}
else
{
field.push(x+":"+Upload.Field[x].Value);
}
}
Upload.Dispose();
Upload = undefined;
Info = field.join("<br>");
}%></head><body>
<font color="red"><%=Info%></font>
<form method=post enctype="multipart/form-data">
field:<input name=field value=testString><br>
upFile1:<input name="upFile1" type="file"><br>
cnfield:<input name=cnfield value=一中文字幕><br>
upFile2:<input name="upFile2" type="file"><br>
otherfield:<input name=otherfield value=dsihf83><br>
<input type="submit"></form></body></html>
Please note: In the attachment below, the components may not be the latest. The address of the latest component is: (The document is saved in UTF-8 encoding)
http://www.zope.org/Members/Rimifon/FyUpload.sct