Results 1 to 3 of 3

Thread: [2005] FTP code, whats missing?

  1. #1

    Thread Starter
    Lively Member technicalItch's Avatar
    Join Date
    Nov 2005
    Location
    England, UK
    Posts
    74

    Question [2005] FTP code, whats missing?

    Whats missing from this code to actually transfer my file to the FTP site? I can see from my FTP server that it makes a connection and starts to upload but doesn't actually get passed 0 bytes.

    VB Code:
    1. Const localFile As String = "C:\scrubs.avi"
    2.         Const remoteFile As String = "/scrubs.avi"
    3.         Const host As String = "ftp://192.168.0.123/"
    4.         Const username As String = "helpdesk"
    5.         Const password As String = "helpdesk"
    6.  
    7.         Dim URI As String = host & remoteFile
    8.         Dim ftp As System.Net.FtpWebRequest = _
    9.         CType(Net.FtpWebRequest.Create(URI), Net.FtpWebRequest)
    10.  
    11.         ftp.Credentials = New _
    12.         System.Net.NetworkCredential(username, password)
    13.  
    14.         ftp.KeepAlive = False
    15.  
    16.         ftp.UseBinary = True
    17.  
    18.         ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFile
    19.  
    20.         ftp.GetRequestStream()

  2. #2
    Hyperactive Member francisstokes's Avatar
    Join Date
    May 2005
    Location
    Kent, England
    Posts
    272

    Re: [2005] FTP code, whats missing?

    It might be because URI is equal to

    Code:
    ftp://192.168.0.123//scrubs.avi
    The second slash might be effecting it.

  3. #3

    Thread Starter
    Lively Member technicalItch's Avatar
    Join Date
    Nov 2005
    Location
    England, UK
    Posts
    74

    Re: [2005] FTP code, whats missing?

    Well spotted but not the problem. I haven't used the variable localFile yet perhaps thats the issue? I'm not sure where to put it though, it must be needed as its the source!

Posting Permissions

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



Click Here to Expand Forum to Full Width