[RESOLVED] AARRGHH!! FTP problems!!
Hi folks! :wave:
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. :ehh:
I've tried both oFTP.DownloadFile and oFTP.GetFile :cry:
Plz help! :confused:
//Alex
Re: Problems downloading with FTP!
I'm maybe using the command wrong...this is my code:
VB Code:
Set oFTP = New CFtp
oFTP.Connect "ftp.gratisplaneten.com", "xxxx", "xxxx"
oFTP.TransferType = FTP_TRANSFER_TYPE_ASCII 'or FTP_TRANSFER_TYPE_BINARY
oFTP.DownloadFile "brain.txt", "/guitar.gratisplaneten.com/adam/brain.txt"
Dim oFile As CFtpFile
For Each oFile In oFTP.Files
If oFile.IsDirectory Then
List1.AddItem "[" & oFile.FileName & "]"
Else
List1.AddItem oFile.FileName
End If
Next
oFTP.CloseConnection
Shouldn't it work??
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:
oFTP.ChangeDir "/path_to_file_directory/"
'oFTP.DownloadFile "Remote File", "LocalFile"
oFTP.DownloadFile "brain.txt", "/My Documents/adam/brain.txt"
Hope this helps
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)
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...
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.
Re: AARRGHH!! FTP problems!!
okey, that sounds resonable...I'll try that soon! Tnx!
Re: AARRGHH!! FTP problems!!
you have the file paths reversed, that downloader uses remote path first and local path second
VB Code:
Public Function DownloadFile(ByVal RemoteFile As String, ByVal LocalFile As String) As Boolean
'you have
oFTP.DownloadFile App.Path & "\brain.txt", "/adam/brain.txt"
'should be
oFTP.DownloadFile "/adam/brain.txt", App.Path & "\brain.txt"
Re: AARRGHH!! FTP problems!!
tnx for your help! I'll reputate at once ;)!
Re: AARRGHH!! FTP problems!!
:( I'm not allowed to reputate you now since I reputated you for a while ago...well, well.
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)
Re: AARRGHH!! FTP problems!!