我使用ASP无组件进行图片上传,但同时要提交一些普通的文本数据,应该怎么做?
我的代码如下:
<%OPTION EXPLICIT%>
<!--#include file="setup.asp"-->
<!--#include file="upload.inc"-->
<%
dim upload,file,formName,iCount
set upload=new upload_5xSoft
if right(formPath,1)<>"/" then formPath=formPath&"/"
iCount=0
for each formName in upload.file
set file=upload.file(formName)
if file.filesize=0 then
HtmEnd "请选择你要上传的文件。"
set upload=nothing
response.end
end if
if file.filesize>cint(uploadsize)*1024 then
HtmEnd "照片文件大小超过了限制。"
set upload=nothing
response.end
end if
if Instr(FileType,GetExtendName(file.FileName)) then
else
HtmEnd "照片文件格式不符合要求。"
set upload=nothing
response.end
end if
dim file_system,sub_files,cur_folder,each_file
set file_system=createobject("scripting.filesystemobject")
set cur_folder=file_system.getfolder(c_path)
set sub_files=cur_folder.files
for each each_file in sub_files
if instr(each_file.name,file.FileName)<>0 then
HtmEnd "您所上传的照片文件 <b> "&file.FileName&" </b> 已经存在,请将文件改名后上传。"
set upload=nothing
response.end
end if
next
set each_file=nothing
set sub_files=nothing
set file_system=nothing
if file.FileSize>0 then
file.SaveAs Server.mappath(formPath&file.FileName)
Session("uplogofile")=file.FileName
iCount=iCount+1
end if
set file=nothing
next
set upload=nothing
sub HtmEnd(Msg)
set upload=nothing
response.write Msg
response.write "<p align=center><a href=javascript:history.go(-1);>返回上一页</a></p>"
response.end
end sub
function GetExtendName(FileName)
dim ExtName
ExtName = LCase(FileName)
ExtName = right(ExtName,3)
ExtName = right(ExtName,3-Instr(ExtName,"."))
GetExtendName = ExtName
end function
%>
提交过来的数据除了有图片的路径外,还有几个文本字段,并且在提交前的输入页面中要使用javascript来验证文本字段的输入是否正确,请问应该如何做。