我有一个类型文件的输入,当我尝试执行请求时。文件在更新面板中包裹时,它总是返回一个空的httpfilecollection。为什么???

这是CodeBehind :(在httpcontext.current.request.files ...始终为0。)

 Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
    Dim uploads As HttpFileCollection
    uploads = HttpContext.Current.Request.Files

    For i As Integer = 0 To (uploads.Count - 1)

        If (uploads(i).ContentLength > 0) Then
            Dim c As String = System.IO.Path.GetFileName(uploads(i).FileName)

            Try
                uploads(i).SaveAs("C:\UploadedUserFiles\" + c)
                Span1.InnerHtml = "File Uploaded Sucessfully."
            Catch Exp As Exception
                Span1.InnerHtml = "Some Error occured."
            End Try

        End If

    Next i

End Sub

此示例来自ASP.NET网站...但是我的应用程序非常相似。

没有正确的解决方案

其他提示

看一下这个 文件上传和更新面板

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top