Click here to Skip to main content
15,039,244 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Imports System.Net.FtpWebRequest
Imports System.Net.NetworkInformation
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'server path            
Dim clsRequest As System.Net.FtpWebRequest =_         
DirectCast(System.Net.WebRequest.Create("E:\Image.jpeg"), System.Net.FtpWebRequest)
            clsRequest.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD")
            clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
            ' read in file...
'local path            
Dim bFile() As Byte = System.IO.File.ReadAllBytes("C:\Image.jpg")
            ' upload file...
            Dim clsStream As System.IO.Stream = _
            clsStream.Write(bFile, 0, bFile.Length)
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.OkCancel)
            If MsgBoxResult.Cancel Then
            End If
        End Try
    End Sub

this code true thıs ıs run but only one image send to ftp server
ı have a fıle ıt has lots of image ı want to send all of them to ftp server
how can ı do?

[EDIT]Tags changed - LOSMAC[/EDIT]
Updated 3-Nov-11 10:20am
DaveAuld 7-Oct-11 11:29am
Create a list of files from the source folder and iterate that list sending each one in turn to the FTP server.

1 solution

An FTP server does not have a top or bottom; one would say it's bottomless (but not topless, even though there is no a "top") :-)

An FTP server does not have a command for uploading of more than one file; such operation has to be a set of operations each uploading a single file, that's it.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900