Response.End()
End sub
Sub closeObject()
'本过程用于关闭对象
set upload=Nothing
set thisFile=Nothing
End sub
%>
以上源代码只要稍作修改即可。最好在父文件使用iFrame标签调用。父文件用于记录上传后文件名的隐藏表单控件名为<input name="P_Image" type="hidden" id="P_Image" value="0">,表单名为"parent.frm_publish"。如表单名和控件名改变,则相应地,源代码红色标注部分也要作相应改变,否则无法传递值。
[FileName]:upload.asp
[Code]:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#i nclude virtual="upload.inc"-->
<%
If Request.ServerVariables("REQUEST_METHOD")="POST" then
'表单提交执行
CONST upFileSize=100 '文件大小限制,单位:KB
CONST upFileType=".gif.jpg.jpeg" '文件类型限制,可根据需要修改
CONST targetPath="/publish/images/" '以网站为根目录的文件存放路径,以"/"结束
dim upload,thisFile,formName,iCount
set upload=new upload_5xSoft ''建立上传对象
Flag=True '初始化文件上传标识
for each formName in upload.ifile '列出上传文件的所有参数
set thisFile=upload.ifile(formName) '生成一个文件对象
If thisfile.filesize=0 then
Flag=False
Msg="请选择你要上传的文件。"
CALL showErr(Msg)
end if
if thisfile.filesize>upFileSize*1024 then
&nb
| 对此文章发表了评论 |

