请教:多文件上传
在复杂的上传界面上,前面四项只上传一个附件,最后一项可上传多个附件。下面的代码中,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