Subir archivos a ftp utilizando un uploadcontrol en asp.net

Para esto debemos agregar un uploadcontrol y llamar un boton para llamar el codigo


Dim clsRequest As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ftp.miftp.com/carpeta/" + FileUpload1.FileName), System.Net.FtpWebRequest)
clsRequest.Credentials = New System.Net.NetworkCredential("usuario", "password")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Dim bFile As Byte() = FileUpload1.FileBytes
Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()

'=======================================================
'=======================================================



Comentarios

Entradas populares de este blog

Batch Tablas de Multiplicar

Sistema de tickets Gratis en php + Mysql