Any way to create a client side FTP connection to download/upload files?

Is there any way to create a client side FTP connection for user to download / upload files from/into a FTP server located in user’s private network?
FTP from server side would be easy but the connection should be established from user’s perspective…

Any ideas? JavaScript any help along with Vaadin?

Browsers (JavaScript) generally only support HTTP and WebSockets communication, so using the FTP protocol won’t work, at least without extensions. I think the most straightforward way would be authenticating the current user on the server first and using that information to connect to the FTP server.

-Olli

Thanks for the input! Not sure what you mean with your suggestion though… Basic idea behind my question is that there would be pre-configured FTP-settings for a single user (user does not need to know them) and user would only click “Open FTP connection”… No problem so far, but as the connection needs to be established from the user’s location it seems to be quite hard to achieve. From network vice the would similar to as if user would open a FileZilla from his/her workstation and start an FTP session to a server in his Local Network.

With JNLP/JavaWebStart this could be done but as these technologies are deprecated in Java9, I would rather not use them.

Another approach that I was thinking:
Is it possible to use Vaadin Upload component (File select dialog) so that dialog would be automatically opened with address like “ftp://ftp_johndoe:MySecretPassword@myLocalServer”?

Would
BrowserWindowOpener
with that FTP URL work?

-Olli

I think we cannot upload/download with BrowserWindowOpener the way I need as the goal is get rid of user’s manual work. After the download with that method, the file would just be saved to user’s workstation and then user would have to use Upload component to send it to WebApp.

In my case user should only be able to point out “this is the file I want to send” by selecting the file. I think that would be quite tricky here, maybe not impossible but maybe would require filename parsing and I think that is browser spesific work…

Also the other way round I think is impossible this way - no way to upload file with FTP URL?

It might theoretically be possible to upload to an FTP server with an XMLHttpRequest (see here: https://stackoverflow.com/questions/14839838/what-is-the-syntax-to-do-a-cross-domain-xmlhttprequest-to-an-ftp-server/15100922#15100922), but really the upload to FTP needs to be started from the server. I don’t think this part is really a problem from the UX point of view, though; you use the Upload component as usual to send the file to your application server, and from the user’s point of view, they’re done. Behind the scenes, you send the file from your application server to the FTP. You can possibly even use streaming to upload to FTP at the same time as you receive bytes from the browser.

-Olli

Thanks! I need to look into that… Still the FTP connection itself from server is not a problem but network vice it is. Application is in public network (Internet) and user’s FTP server is his LAN-network, so the FTP server in in-accessible from application server.

The most important is to get this part working:
Download from FTP-server, upload to Application server via http(s)

Less important is:
Download from Application server, upload to FTP-server