Flash上传文件并提交参数
怎样在Flash中上传文件的同时提交对应的参数呢,用sendVars是无法成功的,看看帮助用getURL就可以实现了,关键是asp代码也要对应改下。
asp代码:
<!--#include file="conn.asp"-->
<!--#include file="upinc.asp"-->
<%dim arr(3)
dim upload,file,formName,formPath,iCount,filename,fileExt,i
set upload=new upload_5xSoft ''建立上传对象
''保存上传图像文件的目录,后面要加(/)
formPath="upimage/"
pic=""
for each formName in upload.file ''列出所有上传了的文件
set file=upload.file(formName) ''生成一个文件对象
if file.filename<>"" then
if file.filesize<0 then
response.write "<font size=2>没有上传的图片数据 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
' if file.filesize>100000 then
' response.write "<font size=2>图片大小超过了限制 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
' response.end
' end if
fileExt=lcase(right(file.filename,4))
if fileExt<>".gif" and fileExt<>".jpg" then
response.write "<font size=2>文件格式不对 [ <a href=# onclick=history.go(-1)>重新上传</a> ]</font>"
response.end
end if
ranNum=int(900*rnd)+100
SaveFileName = SaveFilePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
filename=formPath&saveFileName&lcase(right(file.filename,4))
pic=filename
if file.FileSize>0 then ''如果 FileSize > 0 说明有文件数据
file.SaveAs(Server.mappath(filename)) ''保存文件
iCount=iCount+1
end if
end if
next
'iTitle=upload.form("iTitle")
'iType=upload.form("iType")
'iClass=upload.form("iClass")
iTitle = request.QueryString("iTitle")
iType = request.QueryString("iType")
iClass = request.QueryString("iClass")
set rs=server.createobject("adodb.recordset")
sql="select * from Image"
rs.open sql,db,1,3
rs.addnew
rs("iType")=iType
rs("iName")=pic
rs("iTitle")=iTitle
rs("iClass")=iClass
rs("iCount")="0"
rs.update
rs.close
set rs=nothing
db.close
%>