简体   繁体   English

如何使用Java将文件从本地计算机上传到Web服务以进行ftp传输?

[英]How can I upload a file from my local machine to a webservice for ftp transfer using java?

Requirement --> 1. To create a ftp file uploader application where in I can upload a file from my local machine to ftp server through a web browser. 要求-> 1.要创建ftp文件上传器应用程序,可以在其中通过Web浏览器将文件从本地计算机上传到ftp服务器。 2. TO publish a web service where in webservice client will pass the file and file will be uploaded to the ftp server. 2.要发布Web服务,Web服务将在该Web服务客户端中传递文件,并且文件将被上传到ftp服务器。

Done till now --> 完成到现在->

  1. I can use Apache commons file uploader and can do it very easily using a HTTP connection, with no hassle. 我可以使用Apache commons文件上载器,并且可以很轻松地使用HTTP连接轻松完成此任务。 However, if I dont want to go with HTTP transfer, I can use FTP4J as well, and works well only when browser is IE, because in other browsers, like Chrome, fire fox etc. whenever you use file input element of HTML, it truncates the path of the file selected and just give you file name. 但是,如果我不想进行HTTP传输,那么我也可以使用FTP4J,并且仅在浏览器为IE时才能正常工作,因为在其他浏览器(如Chrome,fire fox等)中,只要您使用HTML的文件输入元素,它截断所选文件的路径,仅提供文件名。 and to resolve this, we end up using enctype=multi-part/form-data tag of HTML in our form action! 为了解决这个问题,我们最终在表单操作中使用了HTML的enctype = multi-part / form-data标签! but this will ask me to use Servlet, and I dont want to transfer using Servlet. 但这将要求我使用Servlet,并且我不想使用Servlet进行传输。

  2. How this can be accomplished? 如何做到这一点?

Why don't you write and use an applet to upload your file(s) ? 您为什么不编写和使用小程序来上传文件? Regards 问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM