Results 1 to 9 of 9

Thread: Another Inet question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Another Inet question

    Hi gurus

    I have so far the following code:
    Code:
    Dim localname As String
    Dim remotename As String
    
    localname = "c:\testfile.txt"
    remotename = "testfile.txt"
    
    
    
     
      With Inet1
         .Url = "ftp://Ftp.theirsite.com/"
         .Username = "myusername"
         .Password = "mypassword"
         .Execute , "CD /myfolder_within_their_ftp"
        finishcmd ' This call for a do while inet.stillexecuting
        
        .Execute "", "PUT " & localname & " " & remotename
        
        finishcmd
      End With
       Inet1.Execute , "CLOSE"
    But nothing happens, I get no error, the appl. ends fines but the files does not upload from my server to their server.
    I dont know if my cd is not necessary, as when I log in to their FTP site I am taken directly to my folder within their FTP server.

    Thanks for any help, I know I am missing something but I dont know what is it

    Thansk a buncH again

  2. #2
    Frenzied Member
    Join Date
    Dec 2007
    Posts
    1,072

    Re: Another Inet question

    Try setting the protocol property to 2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: Another Inet question

    Z.

    Thanks a bunch

    It still does not do anything, the process ends ok with no errors but no file uploaded either.

    Thanks

  4. #4
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Another Inet question

    You need quote marks around the path/filenames. So change it like this:
    Code:
    Dim localname As String
    Dim remotename As String
    
    localname = Chr(34) & "c:\testfile.txt" & Chr(34)
    remotename = Chr(34) & "testfile.txt" & Chr(34)
      '
      '
      '

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: Another Inet question

    JM

    Thanks for jumping in.

    so do you mean that the string should look like this ""c:\testfile.txt""

    Thanks

  6. #6
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Another Inet question

    You were sending this command:

    PUT c:\testfile.txt testfile.txt

    but the server needs to see it like this:

    PUT "c:\testfile.txt" "testfile.txt"

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Another Inet question

    no it would look like
    """c:\testfile.txt"""

    only essential to do this if the file name does /can contain spaces

    i tried the inet code and successfully uploaded a txt file, but it took a few goes to get all the settings right, and no error messages to point to problems, so you just have to persevere until you can get it to work

    you need to get the server responses, so you can tell what is happening on your connection
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Re: Another Inet question

    westconn, """c:\testfile.txt""" is the same as what I posted in #4
    localname = Chr(34) & "c:\testfile.txt" & Chr(34) which results to what I posted in #6 PUT "c:\testfile.txt" "testfile.txt"

    only essential to do this if the file name does /can contain spaces

    Not always so. I have two FTP servers I deal with; one only takes the parameter as I stated it. If I try to either GET or PUT without quotes around the file/path names then the server will not perform the request (just like OP's problem) but when I add the quote marks then the server does the request.
    Last edited by jmsrickland; Oct 22nd, 2008 at 04:17 PM.

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Posts
    138

    Re: Another Inet question

    Thanks gurus, it worked like a charm

    1) how can I implement in my code StateChanged event, so I can keep track of the FTP connection and create a log.

    Thanks and sorry for the low ball after all your help.

    Thanks again

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