Hello… I have been trying to use the charonn0/RB-FTP classes located here: https://github.com/charonn0/RB-FTP
It’s nice work… Probably some of you have already seen it… Anyway… I have gotten to a dead end.
Using the code in GitHub (no changes at all) I can connect, navigate, etc… BUT EVERY file I try to download is corrupted… I notice it immediately by the size and of course it doesn’t open nor run…
So… I need my desktop app to download some updates from my FTP… it’s a pity that I got it working except the download fails… I will not post code, because the tests I am doing here which are failing are with the GitHub code.
Maybe someone can give it a try… or a tip to let me download a file from my FTP without displaying the user/pass, of course…
Have you compared the downloaded file and the original file in a hex editor?
No I haven’t. What should I be looking for ? Downloaded pics don’t open, downloaded apps won’t run. Everything is truncated…
Open both files in a hex editor. Check if some bytes at the beginning or the end are missing. Or if the files are completely different.
In stone age (the 90s) there were different modes for ftp. The code looks so old it might want this. Binary and text modes or something similar.
Connecting works fine with the code. But how do I change the directory?
Yep, connecting is ok… you can browse the FTP with no prob…
The problem is the RETR command. Just type the directory in the param1 textfield… and click in Retr… that should get the download started…
Checked the data with a HexViewer… the contents are totally different… it’s not just truncated…
Also just for the record, Itryed ASCII and 8-bit binary transfer to no avail…
Try clicking the
TYPE I button just before the RETR button to make sure it’s transferring in binary mode.
I tested with both a text and a zip file and both files downloaded fine. Is there an encoding problem with the paths? But then no file would download. Can you post original file and downloaded file?
https://drive.google.com/open?id=0B3LQKr6mspNPTzFiN3F1c3VrWGs <<< ORIGINAL
https://drive.google.com/open?id=0B3LQKr6mspNPLUpNeS1NQW1OMk0 <<< DOWNLOADED
Tried with a txt file… comes up empty… of course downloading it with the usual FTP client downloads fine…
Correction: Text file downloaded ok… don’t know if I did anything… I guess I need some rest…
Will look into it tomorrow… in the meantime if you come up with any great ideas, or workarounds it’ll help a lot.
This is very odd. The downloaded file is indeed the original file, except that the last 2632 bytes are now at the beginning of the file. If you move the bytes back to where they belong the result is byte-for-byte identical to the original. I don’t understand how that could be happening unless the socket itself were delivering the bytes out-of-order.
I could offer with MBS CURL Plugin an alternative which definitively works.
SFTP, FTP and FTPS with proxy, SSL and authentication support and a lot of options.
Back at the computer… I still have no idea either of how/why the downloaded files are corrupted.
Any ideas/solutions to access my FTP OR download the online updates updates for my app ?
My budget is pretty tight and I’d rather not spend the money on a plugin (yet)…
What OS is the application for can you get the OS to FTP the file via a shell command? Does it need to be FTP can you HTTP the file from a web site instead?
Whatever works to download the file from my FTP… and actually if there is an alternative online solution other than my own FTP… that could also work as well… I just need the installed app to donwload its update…
It’s a windows app… I think I could use HTTP instead… I am just not sure how to check if the file it’s there…
Have a look at Kaju (search this forum). This would handle everything for you in regards to updating.
And a normal http socket would work as well.
I tried using an http socket but I get an error 103…
I don’t get it… If I paste the address in a web browser…
I can get to download the file…
How is this supposed to be done via HTTPSocket ? Sorry if this is a too noob question… I just don’t have and experience with this subject…
@Beatrix Willius : I’ve taken a look at Kaju, but it’s not as simple as I would like. To begin with I need to use it’s Admin app, which is yet another step to release the updates, but I’ve also tried that and couldn’t pass the error “Windows binary information is not correct. No hash available”.
I just need a simple solution to check if a file is online, and if its version (or name, version is also contained in the name) is newer , then download it and eventually install it.
Thanks everybody for your help…
Here’s what I created to copy a file from a server:
[code]Public Function getHTTPFolderItemWAD(webSiteURL As String, f As FolderItem, timeOut As Integer = 20) as FolderItem
Dim tempHTTPSocket As New HTTPSocket
Dim tempBoolean As Boolean = False
if webSiteURL = “” then Return nil
if left(webSiteURL, 7) <> “http://” and left(webSiteURL, 8) <> “https://” then 'ensure the URL prefix is correct
webSiteURL = “http://” + webSiteURL
if f = nil or not f.Parent.Exists then Return nil
tempBoolean = tempHTTPSocket.Get(webSiteURL, f, timeOut)
if tempBoolean and f <> nil and f.Exists and tempHTTPSocket.ErrorCode = 0 then
Well I finally made it work.
I dropped the FTP connection in favor of a simple HTTP which works perfect.
This forum is great, I appreciate a lot all your help.
For future readers, please click on the reply that best answers your question, or add your own solution and mark it as the answer.