我没有从浏览按钮上传文件,如何解决?

时间:2013-12-30 11:44:19

标签: asp.net vb.net

我正在使用以下代码:

Try
        Dim j As Integer = 0
        Dim hfc As HttpFileCollection = Request.Files
        Dim PathName As String
        For i As Integer = 0 To hfc.Count - 1
            Dim hpf As HttpPostedFile = hfc(i)

            If hpf.ContentLength > 0 Then
                Try
                    hpf.SaveAs(Server.MapPath("~/F:\ImageUploaded\") & System.IO.Path.GetFileName(hpf.FileName))
                Catch
                    PathName = Server.MapPath(hpf.FileName)
                    Session("PathName") = PathName
                End Try
            End If
        Next
    Catch generatedExceptionName As Exception

        Throw
    End Try

hfc.count总是得零值。如何解决这个问题?

下面的

是我的文件上载控件

< asp:FileUpload ID="FileUpload1" runat="server" />

0 个答案:

没有答案