Could someone provide an example of how to use the MBS CURL plugin to download via FTP?
The “CURLS simple file download.xojo_project” example project included in your MBS plugins download folder is a great place to start.
You will probably want to change the CURLSMBS options to include your user name and password for the FTP server. For example:
d.OptionURL = "ftp://ftp.myftp.com/myfiletodownload.zip"
d.OptionUsername = "Anonymous"
d.OptionPassword = "firstname.lastname@example.org"
Thanks Jim. Michael, do you have more questions? Does it work right away?
That did work. Thank you, Jim!
I was also able to easily loop through an array to download multiple files in a way that seemed logical and simple to me. This is something that I will be doing often in several programs, so that will be helpful.
Are there any problems with doing something like the following?
[code] dim e as integer
dim d as DownloadCURL
dim baseStrng as String
dim fileName as String
dim i, arrayCnt as Integer
Dim nameArray() as String
nameArray = Array(“20140416dj_1.jpg”, “20140416dj_2.jpg”)
baseStrng = “ftp://theServer/PHOTO/20140416dj/”
For i = 0 to UBound(nameArray)
fileName = nameArray(i)
dim dest as FolderItem dest = SpecialFolder.Desktop.Child(fileName) dim b as BinaryStream = BinaryStream.Create(dest, true) // needs to be BinaryStream.Create(dest) in newer RB versions d=new DownloadCURL d.b = b d.OptionURL = baseStrng + fileName d.OptionUsername = "theUser" d.OptionPassword = "thePass!" e=d.Perform b.Close
no, this is okay.
CURL even recycles connections, so it could happen here that it only connects once for all the transfers.
by the way, with newer versions, the plugin can do the File I/O so you don’t need to do that yourself in the read event with a binarystream.
Where is the documentation for the newer versions?
on the website?
It might be there, but I have spent hours there and have found a few examples. The documentation that came with CurlsMBS is hundreds of pages long, but searching for DownloadCURL and UploadCURL returns nothing. I have been able to make CURL work, but only by copying those two classes from the example programs. Perhaps the information I have been looking for is in the files I downloaded, but I have not been able to find it. Without the examples, the plugin would be worthless to me. So far, I have been able to find an example for everything I have wanted to do.
DownloadCURL and UploadCURL are classes found in examples. Not in the plugin!
Good you got it working and sorry of the experience.
I know this is an old thread
but having the same problem as above.
I see the answer and I put password and userID into the correct options. This is fine
then my problem is the the OptionURL.
I put in my string and
I get returned from perform method ,a 3
which is a malformed string.
(const kError_URL_MALFORMAT, = 3)
So Im not setting the string correctly.
My string is “ftp://ftp.loyal.co.nz/runitself”
ftp.loyal.co.nz is my Server
runitself is a folder
These server details and passowrd and userID work in my FTP client - Transmit
Im obviously doing something very simply wrong
But maybe Im too close tho this?
It was simple and dumb!