In FTP server how to upload file ? also select file dynamically? Help me out...
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

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

Threaded View

  1. #1
    Join Date
    Oct 2013
    Posts
    5

    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....

    Code:
    Dim file_NAME As String
            file_NAME = "SIMNextGenOnlineDatabase_SystemArchitectureDocument_v0.1.docx"
    
            'Try
            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)
            stream.Close()
    
            'Upload file
            Dim reqStream As Stream = request.GetRequestStream()
            reqStream.Write(buffer, 0, buffer.Length)
            reqStream.Close()
    
            MsgBox("Uploaded Successfully", MsgBoxStyle.Information)
            'Catch
    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

    Seema
    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
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center