Results 1 to 13 of 13

Thread: [RESOLVED] AARRGHH!! FTP problems!!

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Resolved [RESOLVED] AARRGHH!! FTP problems!!

    Hi folks!

    I've tried using the FTP stuff that they wrote about in this thread:
    http://vbforums.com/showthread.php?t=393703

    I've managed to download with this FTP stuff using the oFTP.UploadFile command, but I can't manage do download it.
    I've tried both oFTP.DownloadFile and oFTP.GetFile

    Plz help!

    //Alex
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Post Re: Problems downloading with FTP!

    I'm maybe using the command wrong...this is my code:
    VB Code:
    1. Set oFTP = New CFtp
    2. oFTP.Connect "ftp.gratisplaneten.com", "xxxx", "xxxx"
    3. oFTP.TransferType = FTP_TRANSFER_TYPE_ASCII 'or FTP_TRANSFER_TYPE_BINARY
    4. oFTP.DownloadFile "brain.txt", "/guitar.gratisplaneten.com/adam/brain.txt"
    5. Dim oFile As CFtpFile
    6. For Each oFile In oFTP.Files
    7.     If oFile.IsDirectory Then
    8.         List1.AddItem "[" & oFile.FileName & "]"
    9.     Else
    10.         List1.AddItem oFile.FileName
    11.     End If
    12. Next
    13. oFTP.CloseConnection

    Shouldn't it work??
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  3. #3
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: Problems downloading with FTP!

    is that file in the root ftp directory, because if it is not, you will need to give the full path to it on the server. Also you have the 2 switched, the first one is remote file loc the second is local folder

    probably like this below

    VB Code:
    1. oFTP.ChangeDir "/path_to_file_directory/"
    2.  
    3. 'oFTP.DownloadFile "Remote File", "LocalFile"
    4.  
    5. oFTP.DownloadFile "brain.txt", "/My Documents/adam/brain.txt"

    Hope this helps
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Angry AARRGHH!! FTP problems!!

    I can't get it!!!

    Why doesn't this work!?!?

    VB Code:
    1. Set oFTP = New CFtp
    2. oFTP.Connect "ftp.guitar.gratisplaneten.com", "xxxxxxxxxx", "xxxxxxxxx"
    3. oFTP.TransferType = FTP_TRANSFER_TYPE_ASCII 'or FTP_TRANSFER_TYPE_BINARY
    4. oFTP.DownloadFile App.Path & "\brain.txt", "/adam/brain.txt"
    5. Dim oFile As CFtpFile
    6. oFTP.ListDir "*", True '<- Second argument (optional): NoCache
    7.     For Each oFile In oFTP.Files
    8.         If oFile.IsDirectory Then
    9.             List1.AddItem "[" & oFile.FileName & "]"
    10.         Else
    11.             List1.AddItem oFile.FileName
    12.         End If
    13.     Next
    14. Dim sText As String
    15. Open App.Path & "\brain.txt" For Input As #1
    16.     sText = Input(LOF(1), #1)
    17. Close #1
    18. Text1.Text = sText

    I've built the download thing after Joacim Anderssons FTP thing here.

    But when it comes to the place where it's supposed to open the file and put it into Text1 it says: "File not found"...why!?!?!

    Please help me! I'm going crazy on this problem!

    //Alex
    Last edited by cyber_alex; May 26th, 2006 at 02:49 AM.
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  5. #5
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Cool Re: AARRGHH!! FTP problems!!

    The file that doesn't exist yet.

    Extract from VB's help...

    "You must open a file before any I/O operation can be performed on it. Open allocates a buffer for I/O to the file and determines the mode of access to use with the buffer.

    If the file specified by pathname doesn't exist, it is created when a file is opened for Append, Binary, Output, or Random modes"

    Note the lack of the word "Input".

    Create an empty text file with notepad and run it again. (You can also do it with code earlier in the procedure)
    Last edited by schoolbusdriver; May 26th, 2006 at 03:46 AM. Reason: More info

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: AARRGHH!! FTP problems!!

    okey, now it doesn't complain about that the file doesn't exist...but it still doesn't download it.. ...wonder what it can be...
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  7. #7
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: AARRGHH!! FTP problems!!

    You need to look at Joacim's thing again.

    An event is fired once the file is downloaded. It is in this event that you should open the file and put the contents in the textbox. Your code above tries to open the file before it is finished downloading.

    r0ach™
    Don't forget to rate the post

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: AARRGHH!! FTP problems!!

    okey, that sounds resonable...I'll try that soon! Tnx!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  9. #9
    Frenzied Member bmahler's Avatar
    Join Date
    Oct 2005
    Location
    Somewhere just west of the Atlantic
    Posts
    1,568

    Re: AARRGHH!! FTP problems!!

    you have the file paths reversed, that downloader uses remote path first and local path second

    VB Code:
    1. Public Function DownloadFile(ByVal RemoteFile As String, ByVal LocalFile As String) As Boolean
    2.  
    3. 'you have
    4. oFTP.DownloadFile App.Path & "\brain.txt", "/adam/brain.txt"
    5.  
    6. 'should be
    7. oFTP.DownloadFile  "/adam/brain.txt", App.Path & "\brain.txt"
    Boooya
    • Visual Studio 2008 Professional
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • Don't forget to rate helpful posts!
    • If you're question was answered please mark your thread [Resolved]


    Code Contributions:
    PHP
    PHP Image Gallery v1.0PHP Image Gallery v2.0
    VB 2005
    Find Computers on a networkSimple License EncryptionSQL Server Database Access dllUse Reflection to Return Crystal ReportDocumentSilently Print PDFGeneric Xml Serailizer


    Useful Links: (more to come)
    MSDN (The first and foremost)MSDN Design Guidelines API Reference • Inno Setup CompilerInno Setup PreprocessorISTool - Fairly easy to use GUI for creating inno setup projects • Connection StringsNAnt -Automated BuildsCruise Control .NET - Frontend for automated builds

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: AARRGHH!! FTP problems!!

    tnx for your help! I'll reputate at once !
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  11. #11

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: AARRGHH!! FTP problems!!

    I'm not allowed to reputate you now since I reputated you for a while ago...well, well.
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

  12. #12
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: AARRGHH!! FTP problems!!

    Quote Originally Posted by cyber_alex
    I'm not allowed to reputate you now since I reputated you for a while ago...well, well.
    So, is this resolved?

    (Duplicate threads merged)

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Apr 2006
    Location
    Sweden
    Posts
    173

    Re: AARRGHH!! FTP problems!!

    hrmm, sure! I'll fix it!
    Please Help Us To Save Ana

    You never fail before you stop trying!
    ______________________________
    If I manage to say something good...please reputate
    ______________________________
    ________

    Links:
    Intellithing
    Digitala.nu
    Norrköpings Goklubb
    WoW Trade Center

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