== 高分求救:无组件上传函数 !@@#¥= 分不够再给
上传表态页面:pictest.htm
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form action="pictest.asp" method="post" enctype="multipart/form-data" name="form1">
<input name="picinfo" type="text" id="picinfo">
<br>
<input name="pic" type="file" id="pic">
<br>
<input type="submit" name="Submit" value="Submit">
</form></body>
</html>
上传页面:pictest.asp 其中conn.asp是数据库链接文件
<!--#include file="conn.asp"-->
<!--#include file="comm.asp"-->
<!--#include file="upload_5xsoft.inc"-->
<%
on error resume next
set upload=new upload_5xsoft ''建立上传对象
call SavePic("photo")
picinfo = upload.form(trim("picinfo"))
echo filename&"<br>"&picinfo
call EndSavePic
%>
函数页面:comm.asp
'***** 输出简写 *****
sub echo(s)
Response.write s & chr(13) '输出单行内容, 加“回车”
end sub
Function getExt(ename)'得到文件扩展名
getExt = right(ename, 3)
End Function
Function isPIC(fileName) '检测是否为图片类型
ext = getExt(fileName)
picType = "jpg,gif,png" '图片类型 (使用","将图片格式分开)
isPIC = False
typeList = split(picType, ",")
For ii = LBound(typeList) To UBound(typeList)
If UCase(ext) = UCase(typeList(ii)) Then
isPIC = True
Exit For
End If
Next
End Function
'*********无组件上传图片函数**********
Function SavePic(path)
dim upload,file,filename
if right(path,1)<>"/" then
path = path&"/"
end if
thefilename = year(date())&month(now())&day(now())&hour(now())&minute(now())&second(now())
set file=upload.file(formname)
filename2 = getext(file.FileName)
response.Write("asdfasdfasdfasdfasd")
if IsPic(filename2) then
if file.FileSize < 0 or file.FileSize > 200*1024 then
echo "未选择图片文件或是图片文件超过200K,请核对后重新上传!<br>"
echo "<a href='javascript:window.history.back()'>返回</a>"
else
filename = thefilename&"."&filename2
file.SaveAs Server.mappath(path & filename)
response.write file.FilePath&file.FileName&" ("&file.FileSize&") => "&Path&File.FileName&" 成功!<br>"
end if
else
echo "文件类型不对,请核对后重新上传!只支持JPG\GIF\PNG图片类型!<br>"
echo "<a href='javascript:window.history.back()'>返回</a>"
end if
End function
'*********无组件上传图片结束函数**********
Function EndSavePic()
set file=nothing
set upload=nothing
End Function
问题:为什么执行后页面是一片空白,而图片也未上传,就连基本的输出信息都看不到呢:?想知道化境无组件上传可不可以这样写成函数,如果可以的话,请指出小弟问题出在哪里!!~
感谢各位帮忙了,分不够再加,,急!!~~~~~~~~~~~~~~~