문제

I have a input of type file and when i try to do a Request.files when the input is wrapped in an update panel...it always returns an empty httpfilecollection. Why???

This is the codebehind: (At HttpContext.Current.Request.Files...its always 0 for the count.)

 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

This example comes from the ASP.Net website...but my application is very similar.

올바른 솔루션이 없습니다

다른 팁

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top