Entradas

Mostrando entradas de junio, 2012

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() '======================================================= '=======================================================