Skip to content

File upload control

kirti tilavat

Asked Oct 11, 2007, 2:04 AM EDT1 answer
Share
LinkedInX
how i get the file name from dynamically generated file upload control

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    try the following code u will get a file name

    Dim Files As HttpFileCollection
            Dim intCount as integer
            Dim arrCount() As String

            Files = Request.Files
            arrCount = Files.AllKeys ' This will get names of all files into a string array.

            For intCount = 0 To arrCount.GetUpperBound(0)
                If arrCount(intCount).StartsWith("fuAttachment") Then 'Filter for certain file upload control id to be saved
                     'Save file                    
                     Files(arrCount(intCount)).SaveAs(strPath & System.IO.Path.GetFileName(FormatFileName(Files(arrCount(intCount)).FileName)))
                End If
            Next

    0