日期:2014-05-17  浏览次数:20895 次

如何做到图片和其他信息同时上传
如果先上传图片
信息还没生成

先提交信息
上传图片就只能在下一页

有办法同时吗

------解决方案--------------------
photo = Request.Form( "file1 ")
If photo <> " " Then
Function GetFileName(ByVal strFile)
If strFile <> " " Then
GetFileName = mid(strFile,InStrRev(strFile, "\ ")+1)
Else
GetFileName = " "
End If
End Function

Set objStream1 = Server.CreateObject( "ADODB.Stream ")
objStream1.Type = 1 ' adTypeBinary
objStream1.Open
objStream1.LoadFromFile photo
objStream1.SaveToFile Server.MapPath( "photo\ "&Year(date)&Month(date)&Day(date)&Hour(Time)&Minute(time)&Second(time)&GetFileName(photo)),2
objStream1.Close

imagepath= "photo\ "&Year(date)&Month(date)&Day(date)&Hour(Time)&Minute(time)&Second(time)&GetFileName(photo)
Else
imagepath= " "

获得图片路径,然后和信息一块插入数据库。
------解决方案--------------------
photo = Request.Form( "file1 ")
name requst/From( "name ")
If photo <> " " Then
GetFileName = mid(strFile,InStrRev(strFile, "\ ")+1)
Else
<script> alert( "您没有上传图片! ");window.history(-1); </script> '如果没有地址就返回
End If

Dim filepath = Server.MapPath( "photo\ "&Year(date)&Month(date)&Day(date)&Hour(Time)&Minute(time)&Second(time)&GetFileName(photo)& ". "& GetFileFilter)
Set objStream1 = Server.CreateObject( "ADODB.Stream ")
objStream1.Type = 1 ' adTypeBinary
objStream1.Open
objStream1.LoadFromFile photo
objStream1.SaveToFile filepath,2
objStream1.Close

updata 表格 set imgpath = filepath,name=name…… '这里就是更新的代码后面就是一直的字段名=得到的数据

------解决方案--------------------
http://blog.programfan.com/article.asp?id=26213
是不是这个