I need to create an invoice file and ftp it to the accountants ftp and append it to a file if it exists else create a new one. To do that from a desktop app I use the shell command . On XojoCloud I’m trying
dim s as new shell
fwp=New XojoCloud.FirewallPort(21, XojoCloud.FirewallPort.Direction.Outgoing)
fwp.Open() // This call is synchronous
If fwp.isOpen() Then
if f <> nil then
dim cm as string ="curl -s -S -u : FTP://address/hm.csv -a -T "+chr(34)+f.nativepath+chr(34)
… end if etc…
The above works locally without the firewallport obviously.
Any pointers would be appreciated
What does the shell return?
That will probably give you more insights.
Thinking of it twice, it has been a while that I tested Xojo Cloud, I believe I remember that you only have access to a limited amount of commands in Shell. Xojo Cloud is really very secure, I doubt they will allow an insecure FTP-ing … if you own the MBS Plugin: I remember that the CURL Plugin worked for me.
Anyways, the results of your shell command shall point you into the right direction.
I wish I could get to the shell part. It looks as if the specialfolder (Documents or Temporary) doesn’t exist. I assumed they were there but have now tested for nil or not exists and I’m getting that .
The documentation for SpecialFolder mentions that some locations may not exist or could be nil objects from SpecialFolder.
What’s weird is that on Xojo Cloud both of those should exist:
For Xojo Cloud, these are the only SpecialFolder methods that are usable. All others return Nil:
SharedDocuments: The web server Shared_Documents folder.
Documents: The Documents folder within the web app folder.
Temporary: The web server tmp folder.
Can you please something simple in your shell like:
Just to see if the shell works in principle and you could test with SpecialFolder.Temporary were Xojo Cloud is storing temporary or Documents files for instance by showing the values in a web text area …
That sounds like you perhaps need to deploy first a Documents folder within your app? Unfortunately I cancel my Xojo Cloud account, so I can’t test it for you.
It looks like the problem is that FTP uses multiple ports in both directions. Port 21 is only used for the initial connection. There’s no way to know what ports the other end will want to use.
I think that using SFTP (instead of FTP) will work though.
I would highly recommend in not using FTP via command line via curl.
better use CURLSMBS class in MBS Xojo CURL Plugin to upload via FTP, SFTP or FTPS.
That was my initial assumption too, but it seems that @Fred_Stephenson from his following response doesn’t even make it even to the shell command and is somehow struggling with the special folders (if I understand him correctly). I can’t remember where the documents folder is located, I believe the SharedDocuments folder is located in the root of XojoCloud, isn’t it? But you @Jason_Parsley definitely know exactly . Though the built-in Xojo methods should just use the right folders as specified … interesting issue …
Thanks , I don’t want to upload. I want to create a file in my web app and send it to the accountants ftp server and append it to an existing file. Or are you suggesting that I use CURLSMBS to do that?
This process is called uploading (from your server to your accountant’s)
Instead of curl in shell, you can use CURLSMBS class to have it be part of your application.
And it can do SFTP for you to upload to a server directly from within your app. e.g. from string/memoryblock to avoid files.
Ta, just wanted to be sure that we were talking about the right direction as one can also upload to the web app
It also looked to me like it could be related to SpecialFolder but I don’t think that’s where the problem is.
Jeannot, my bad for the folders… I’d used <> instead of = in my condition. Thanks. I think I’ll try CURLSMBS and give up on the shell.
Thanks Christian, I’ll give it a whirl.
As @Jason_Parsley said, the shell will probably work with SFTP if your Firewall Setting work correctly. But the CURLSMBS has many(!) more useful features and is very fast. One feature I like most is that you can activate a descriptive debuglog. That’s extremely helpful if you have to work with remote servers w/o having root access on that and you can’t check / change settings on that host.
On a side note: please don’t use FTP any longer, even though it is perhaps a bit easier. I would not even use it in a local network any longer. But perhaps that means that you have to “convince” the accountants to convert FTP to SFTP. If they currently only have FTP enabled, this doesn’t mean that SFTP will work out-of-the-box.
I have purchased a licence for CURLMBS and will use that, if and when I figure out how to implement it… I haven’t found any examples so it’s nose into documentation time.
Unfortunately, I have no choice in the ftp matter, at least for the moment. My client uses an accounting company and they have “reluctantly” given me access to ftp. It’s all a bit, dare I say “ancient” - please send your EHF Faktura in a csv file and then we will enter it into the accounting package …
Thanks to all for your help.
Yes, I had such customers too . Educating sometimes helps, but not always … at least it might help you one day, that you told them. Every one has the freedom to do silly things, even customers .