Visual WebGui Controls - OpenFileDialog

Overview
Allows user to upload a file to the webserver from their browser.

Example
    Private Sub Btn_Upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_Upload.Click
        OpenFileDialog1.InitialDirectory = My.Settings.InitialDirectoryPath
        OpenFileDialog1.Title = "File to Send"
        OpenFileDialog1.Multiselect = True
        OpenFileDialog1.ShowDialog()
    End Sub

    Private Sub OpenFileDialog_Closed(ByVal sender As Object, ByVal e As EventArgs) Handles OpenFileDialog1.Closed

        Select Case OpenFileDialog1.DialogResult
            Case DialogResult.OK
                'Slower version
                'For Each myKey As String In OpenFileDialog1.Files
                '    Dim myFile As Gizmox.WebGUI.Common.Resources.HttpPostedFileHandle = _
                '           OpenFileDialog1.Files(myKey)
                '    Dim myFileName As String = myFile.FileName
                '    Dim myPostedFileName As String = myFile.PostedFileName
                '    Dim myStream As IO.Stream = myFile.InputStream
                ' Next

                For i As Integer = 0 To OpenFileDialog1.Files.Count - 1
                    Dim myFile As Gizmox.WebGUI.Common.Resources.HttpPostedFileHandle = _
                        OpenFileDialog1.Files(i)
                    Dim myFileName As String = myFile.FileName
                    Dim myPostedFileName As String = myFile.PostedFileName
                    Dim myStream As IO.Stream = myFile.InputStream
                Next

        End Select
    End Sub

Usage with Adobe Flash v10+

Last edited Sep 8, 2009 at 12:20 AM by Palli, version 6

Comments

No comments yet.