看看这段无组件上传代码。够简洁不?
觉得还满意就来下载本类吧~~只为给大家提供方便,绝无他意!
[bo]http://www.[/bo]
不满意表骂我灌水就好了~
程序代码:
<!--#include file="Upload_class.asp"--> <form name="upload" method="post" action="?act=upload" enctype="multipart/form-data"> 请选择一个文件:<br /> 文件:<input class="iFile" id="file1" type="file" name="file1" size="40" /> <input class="iButton" type="submit" value="开始上传" /> </form> <% if request.querystring("act")="upload" then Dim bdata,myupload,form,file,tempCls,totalSize totalSize=request.totalbytes bdata=request.binaryread(totalSize) '================================================================================== set myupload=new UpLoad '创建类实例 myupload.Path=server.mappath("files") '设置上传路径(必须) myupload.MaxSize=1*1024*1024 '设置最大上传限制,按字节计;默认为不限制 myupload.Exe="rar|jpg|gif|bmp" '设置合法扩展名,以|分割,忽略大小写 myupload.GetData(bdata) '获取并保存数据 '================================================================================== if myupload.Err<=0 then path=server.mappath("files") set tempCls=myupload.files("file1") tempCls.SaveToFile path,0 '以时间+随机数字为文件名保存 response.write tempCls.FileName&"上传完毕,大小为"&myupload.getsize(tempCls.Size)&",本地路径"&myupload.forms("file1") set tempCls=nothing else response.write myupload.Description end if set myupload=nothing '销毁类实例 end if %>
[[it] 本帖最后由 anlige 于 2008-8-21 02:57 编辑 [/it]]