CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Threaded View

  1. #1
    Join Date
    Oct 2013

    In FTP server how to upload file ? also select file dynamically? Help me out...

    Hi friends,

    Its very urgent, plz help me out how to get the o/p for the elow issue....

    Dim file_NAME As String
            file_NAME = "SIMNextGenOnlineDatabase_SystemArchitectureDocument_v0.1.docx"
            Dim request As FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://ustr-erl-2103/" + file_NAME), System.Net.FtpWebRequest)
            request.Method = WebRequestMethods.Ftp.UploadFile
            request.Credentials = New NetworkCredential("", "")
            request.UsePassive = True
            request.UseBinary = True
            request.KeepAlive = False
            'Load the file
            Dim stream As FileStream = File.OpenRead("E:\Madhu\MyPOCs\ClassLibrary1.dll")
            Dim buffer As Byte() = New Byte(CInt(stream.Length - 1)) {}
            stream.Read(buffer, 0, buffer.Length)
            'Upload file
            Dim reqStream As Stream = request.GetRequestStream()
            reqStream.Write(buffer, 0, buffer.Length)
            MsgBox("Uploaded Successfully", MsgBoxStyle.Information)
    In the above code its showing its uploaded but when i log in to the server i am not finding the file. Plz help me...
    Thanks in advance

    Last edited by seems.29s; November 28th, 2013 at 04:42 AM. Reason: correcting code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)