• 【设为首页】
  • 【收藏闪客居】
当前位置:主页>FLASH AS 编程>flash和WEB程序应用>文章内容
  • Flash上传文件并提交参数
  • 来源:DoFlash Studio 作者:DoFlash Studio 2007-10-18 【

怎样在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

%>



上一篇:数据交互之--WebService应用   下一篇:FLASH AS:如何运用Flashvars传参
  • 用户名:新注册) 密码: 匿名评论
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
推荐内容

Copyright © 2006-2008 flashas.net All Rights Reserved.
网站内容咨询: admin#flashas.net (#为@) 联系QQ:40777822 浙ICP备06033001号
(本网站最佳浏览解析度为1024*768, 建议使用IE 6.0或以上版本浏览器。)