请教:多文件上传
在复杂的上传界面上,前面四项只上传一个附件,最后一项可上传多个附件。下面的代码中,files.count包含了所有的附件,怎样得到最后一项的附件呢?请教高手!
Dim files As System.Web.HttpFileCollection = System.Web.HttpContext.Current.Request.Files
' Dim PostedFile As System.Web.HttpPostedFile
If File8.PostedFile.FileName <> "" Then
For i = 0 To files.Count - 1
PostedFile = files(i)
intFileLen = PostedFile.ContentLength
FileName = System.IO.Path.GetFileName(PostedFile.FileName)
FileExtension = PostedFile.ContentType.ToString()
If FileName <> "" Then
s2 = Session.SessionID.ToString & FileName
ss = "insert into itemfile (itemID,iclass,FileName,FileLength,FileFormat) values (" & CInt(Session("itemid")) & ",'8','"
ss = ss & s2 & "'," & intFileLen & ",'" & FileExtension & "')"
Funlib.MysqlMethod(ss)
spath = Server.MapPath("./")
fn = spath & "uploads" & Session.SessionID.ToString & FileName
PostedFile.SaveAs(fn)
End If
Next
Else 'wu fu jian
End If
[解决办法]
其实files.count这个没有意义
多文件上传其实还是一个个传的(flash还是一个个的提交)
[解决办法]
参考这是否是你想要的多文件多线程上传