Results 1 to 32 of 32

Thread: Gadnammit, This should work!

  1. #1

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425

    Question Gadnammit, This should work!

    ..I think...

    Anyway, here's the story. I'm using the Inet Transfer control to upload a file to a remote server via FTP. When I use this line of code, the file uploads fine:

    Code:
    inetFTPTest.Execute , "PUT C:\ftptest\config\ftptest.bok /htdocs/ftptest.bok"
    but when I attempt to use App.Path in this line, ie

    Code:
    inetFTPTest.Execute , "PUT " & App.Path & "\config\ftptest.bok /htdocs/ftptest.bok"
    The file will not upload. Am I using App.Path incorrectly? Won't App.Path work with the Inet control?

    Help Me Please!

    Thanks in advance...

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    is App.Path the same as C:\ftptest ?

    and do you get any errors ?
    -= a peet post =-

  3. #3
    Medicus
    Guest
    I don't think you are using the App.Path correctly.

    Check for the Admin Path. I think. The App.Path is probably looking in your machine.

    The C: is hardcoded in your source.

    Let me know if that helps.

  4. #4
    ExplosiveNewt
    Guest
    Are you doing error checking? if so what error are you getting also. try doing on the line before
    MyTempFile = "PUT " & App.Path & "\config\ftptest.bok /htdocs/ftptest.bok"
    inetFTPTest.Execute , MyTempFile

    I Think this has happened to me and that fixed it

  5. #5

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Newt, I've tried what you suggested, and it didn't work. Also, no errors are being returned, which makes me wonder what exactly is happening.

    peet and Medicus, App.Path specifies the directory from which the program is being run, on my machine.

    Any other ideas, Guys?

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Originally posted by CyberSurfer
    .... App.Path specifies the directory from which the program is being run, on my machine.

    yes, i understand, I was wondering if the app.path might contain spaces or folders with more tha 8 chars ... something that differs from C:\ftptest

    -= a peet post =-

  7. #7

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Good point. In actual fact App.Path is longer than 8 chars, and contains spaces. I just put C:\ftptest to save me typing out the whole path.

    Does this tell you what I'm doing wrong?

  8. #8
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Its just a thought, I'v experienced this kind of strange behavior when using the shell function. It doesnt give an error, and nothing happens ... like in your case.

    just to make sure... move the exe to a folder like the one you used in the sample, and see what happens ...

    huh.. Its a long shot, but what do you have to loose
    -= a peet post =-

  9. #9
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    also add a msgbox showing you the content of App.Path when running the exe....
    -= a peet post =-

  10. #10

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Thanks peet!

    The message box listes App.Path as

    Code:
    C:\Jonathans Bits n' Pieces\Visual Basic\Projects\Booking System
    and the program worked when I moved the exe to C:\ftptest.

    Any ideas how to get the program to work from directories including spaces et al?

  11. #11
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    try using " "
    -= a peet post =-

  12. #12
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Code:
    inetFTPTest.Execute , "PUT " & """" &  App.Path  & "\config\ftptest.bok & """" /htdocs/ftptest.bok"
    -= a peet post =-

  13. #13

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Nope, that still doesn't work...

  14. #14
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    notice ...

    I misplaced the last & """" at first.. I'v changed it....

    if you already noticed... try single quot "'" instead ...
    -= a peet post =-

  15. #15
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hmm... I'm just guessing here.... (but u probl. noticed that already)
    -= a peet post =-

  16. #16
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    GetShortFileName?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  17. #17
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    good Idea parksie

    Code:
    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal lBuffer As Long) As Long
    
    Public Function GetShortPath(strFileName As String) As String
    Dim lngRes As Long, strPath As String
    'Create a buffer
    strPath = String$(165, 0)
    'retrieve the short pathname
    lngRes = GetShortPathName(strFileName, strPath, 164)
    'remove all unnecessary Chr$$(0)'s
    GetShortPath = Left$(strPath, lngRes)
    End Function
    -= a peet post =-

  18. #18

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Back in an hour...I'll try it then..

  19. #19
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    nice avatar parksie
    -= a peet post =-

  20. #20
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Hehe thanks
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  21. #21
    Medicus
    Guest
    Did everybody just get out of bed ?

    Where the hell have you been when I was figthing for the Life of "oops, another one".

    Arrrggghhh...

  22. #22
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    huh... Medicus ?? need help? ...
    -= a peet post =-

  23. #23
    Medicus
    Guest

    Well,

    I called the freakin guy in India @ 1.75$ a minute.

    Everybody needs help!

    Don't make me start on this...

  24. #24
    Medicus
    Guest
    peet, I like you a lot.

    Hey, I don't say that to everybody. Even if you are a female, I'll like you anyway...

    Love xxx

    Bert

  25. #25
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    god damn Medicus your scary

    -= a peet post =-

  26. #26
    Medicus
    Guest
    Just keep your hands in your pants and everything will be ok.

  27. #27
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    what make you think I'm wearing any ??
    -= a peet post =-

  28. #28
    Medicus
    Guest
    Just your tone of voice and the fact that your are only using one hand.

  29. #29

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Not being very familiar with the use of API and suchlike fun-ness, I'm not exactly sure what I'm supposed to do with GetShortFileName, and how it solves my problem. Any help?

  30. #30
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Code:
    dim sFTPCommand As String
    
    sFTPCommand = "PUT " & GetShortPath(App.Path & "\config\ftptest.bok) & " /htdocs/ftptest.bok"
    inetFTPTest.Execute , sFTPCommand
    the GetShortPath function returns the path in the ~1 style

    eg c:\progra~1\myapp\app.exe
    -= a peet post =-

  31. #31

    Thread Starter
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425
    Superb! It works

    Thanks to Parksie, and especially peet..

  32. #32
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    any time CyberSurfer
    -= a peet post =-

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