Results 1 to 12 of 12

Thread: How do I Pass variable in PUT command

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316

    Question

    I am trying the following code, but it will not send the File:

    Code:
    Private Sub cmdSend_Click()
    Dim strFileName As String, strFileTitle As String
    strFileName = CommonDialog1.FileName
    strFileTitle = CommonDialog1.FileTitle
    
    With Inet1
            .Protocol = icFTP
            .URL = "xxx.xxx.xxx.xxx"
            .UserName = "xxx"
            .Password = "xxx"
            .Execute , "PUT " & strFileName & " " & strFileTitle
        End With
    End Sub
    x = unique address, username, password

    *If I forget the string variables and just type the text into the code of where it should go then it works fine.

    Can someone please help?

    [Edited by bedowin on 08-24-2000 at 01:25 PM]
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  2. #2
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Your code:

    .Execute , "PUT " & strFileName & " " & strFileLocation

    Should strFileLocation be strFileTitle instead ?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316
    Sorry, that was just a mistype... it really is...

    Code:
    Private Sub cmdSend_Click()
    Dim strFileName As String, strFileTitle As String
    strFileName = CommonDialog1.FileName
    strFileTitle = CommonDialog1.FileTitle
    
    With Inet1
            .Protocol = icFTP
            .URL = "xxx.xxx.xxx.xxx"
            .UserName = "xxx"
            .Password = "xxx"
            .Execute , "PUT " & strFileName & " " & strFileTitle
        End With
    End Sub
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  4. #4
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Might try the following:

    .Execute , "PUT " & "'" & strFileName & "'" & " " & "'" & strFileTitle & "'"

    Hard to see, but that is placing a single quote within double quotes before and after the string variable.

    You can probably combine some of that together so you will not have so many "&" signs, but the general idea is to quote your strings within the command.

    [Edited by jbart on 08-24-2000 at 01:37 PM]

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316
    No, that returns a syntax Error.
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  6. #6
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    I left off the last "&" in my original post. Do you still get a syntax error with the correction ?

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316
    No, but now it just doesn't do anything all over again... It just sits there...
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316

    Talking

    Hello.. is anyone still out there?
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  9. #9
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    736
    Just me. I cannot think of anything else to try. I experienced the same problem you are having, but placing the quotes around the string variables solved it for me.

    Anyone else have ideas ?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316

    Smile

    Could you send me the sample code you used that worked? [email protected]

    Thanks!
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316
    This works:

    Code:
    Private Sub cmdSend_Click()
    Dim strFileName As String, strFileTitle As String
    strFileName = CommonDialog1.FileName
    strFileTitle = CommonDialog1.FileTitle
    
    With Inet1
            .Protocol = icFTP
            .URL = "xxx.xxx.xxx.xxx"
            .UserName = "xxx"
            .Password = "xxx"
            .Execute , "PUT C:\Test.txt Test.txt"
        End With
    End Sub
    But this does not:

    Code:
    Private Sub cmdSend_Click()
    
    With Inet1
            .Protocol = icFTP
            .URL = "xxx.xxx.xxx.xxx"
            .UserName = "xxx"
            .Password = "xxx"
            .Execute , "PUT " & strFileName & " " & strFileTitle
        End With
    End Sub
    And, again I've tested to see if the variables are turning up the right information and they are.
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    316

    Unhappy

    I cannot believe no one has encountered this problem before... (
    Using VS 6 Enterprise w/ SP5 & Windows 2000 Professional

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