Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6157717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:49:55+00:00 2026-05-23T20:49:55+00:00

I am able to upload a single file and now how do I upload

  • 0

I am able to upload a single file and now how do I upload multiple files to FTP server :

Here is the code I am working with:

Private Sub uploadFile(ByVal FTPAddress As String, ByVal filePath As String, ByVal username As String, ByVal password As String)
‘Create FTP request

    Try
        Dim request As FtpWebRequest = DirectCast(FtpWebRequest.Create(FTPAddress & "/" & Path.GetFileName(filePath)), FtpWebRequest)

        request.Method = WebRequestMethods.Ftp.UploadFile
        request.Credentials = New NetworkCredential(username, password)
        request.UsePassive = True
        request.UseBinary = True
        request.KeepAlive = False

        'Load the file
        Dim stream As FileStream = File.OpenRead(filePath)
        Dim buffer As Byte() = New Byte(CInt(stream.Length - 1)) {}

        stream.Read(buffer, 0, buffer.Length)
        stream.Close()

        'Upload file
        Dim reqStream As Stream = request.GetRequestStream()
        reqStream.Write(buffer, 0, buffer.Length)
        reqStream.Close()

        MsgBox("Uploaded Successfully", MsgBoxStyle.Information)
    Catch
        MsgBox("Failed to upload.Please check the ftp settings", MsgBoxStyle.Critical)
    End Try
End Sub


Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
    btnUpload.Enabled = False
    Application.DoEvents()
    uploadFile(txtFTPAddress.Text, txtFilePath.Text, txtUsername.Text, txtPassword.Text)
    btnUpload.Enabled = True
End Sub

This is how I modified but not working:

 If Me.FolderBrowserDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
        Dim f As New IO.DirectoryInfo(Me.FolderBrowserDialog1.SelectedPath)
        For Each file As IO.FileInfo In f.GetFiles
            Select Case file.Extension.ToLower
                Case ".jpg", ".bmp", ".gif", ".png", ".ico"
                    CheckedListBox1.Items.Add(file.FullName, CheckState.Checked)
            End Select
        Next
        For pix As Integer = 0 To CheckedListBox1.CheckedItems.Count - 1
            btnUpload.Enabled = False
            Application.DoEvents()
            uploadFile(txtFTPAddress.Text, txtFilePath.Text, txtUsername.Text, txtPassword.Text)
            btnUpload.Enabled = True
        Next
    End If
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T20:49:56+00:00Added an answer on May 23, 2026 at 8:49 pm
    For Each _____ in ______ collection
    uploadFile(txtFTPAddress.Text, txtFilePath.Text, txtUsername.Text, txtPassword.Text)
    Next
    

    (filling-int he blanks depends on whatever control you’re using to store the file names in.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need the user to be able to upload multiple files to my server,
I am able to have my application upload files via FTP using the FTPClient
To be able to upload large files from a HTML page to a FTP
I want to be able to upload a file onto my server. I know
I want users to be able to upload audio files to my server (say,
I'm working on a program where I am uploading multiple files to an FTP.
I have a View in which the user is able to upload a file
I need to be able to upload several files to a database, and associate
I am trying to use the multiple upload attribute of HTML5 to upload files.
I am able to upload file in joomla. I want to know if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.