请教.关于上传组件.没有上传内容的时候.判断是否为空..

召耳先生 2011-05-10 01:26:24
表单代码:
<form name="upload" method="POST" action="upload.asp" Enctype="multipart/form-data">
文件1 <input type="file" name="file1" /><br />
文件2 <input type="file" name="file2" /><br />
文件3 <input type="file" name="file3" /><br />
<br />
       <input class="iButton" type="submit" value="开始上传" />
</form>


upload.asp中部分代码:

set tempCls=Upload.files("file2")
Set e = tempCls.SaveToFile(path,0)
if e.error then
response.Write e.description
else
response.write "文件:" & tempCls.FileName & "上传完毕,扩展名为" & tempCls.extend & ",大小为" & Upload.getsize(tempCls.Size) & ";原文件名" & tempCls.LocalName & "!<br />"
End If
set tempCls=nothing


我想在执行这段之前先判断一下,这个上传的文件是否为空...

if isnull(Upload.files("file2"))=0 then

response.Write("空值")
else

set tempCls=Upload.files("file2")
省略代码
set tempCls=nothing

end if
...全文
85 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
召耳先生 2011-05-19
  • 打赏
  • 举报
回复
其实没人回答对...算了给分了交个朋友
灬上海爽爷 2011-05-10
  • 打赏
  • 举报
回复
if e.error then
response.Write e.description
else
if Upload.files(-1).count>0 then
response.write("选择")
else
response.write("没选择")
end if
召耳先生 2011-05-10
  • 打赏
  • 举报
回复
没人吗????为什么呢

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧