如何使用java将文件上传到http远程服务器? [英] how to upload file to http remote server using java?

查看:1075
本文介绍了如何使用java将文件上传到http远程服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从我的应用程序上传图像和txt文件到远程服务器(只是http没有ftp)使用java。我的应用程序是在JSF框架。我搜查,但没有找到合适的东西。
任何人都可以引导我吗?
其实我应该上传文件到特殊文件夹到远程服务器。
我有两个应用程序共享路径上传文件,所以为了访问它们到这个文件,我决定上传共享文件(如图像和文本)到第三个服务器。第一个应用程序应该将文件上传到远程服务器,第二个应用程序应该从中读取它们
因此,这个解决方案的难点在于使用http将文件上传到第三个服务器(实际上是远程服务器)。



服务器端用于接收上传的文件,可以使用http://commons.apache.org/fileupload/



客户端发送文件上传请求,您可以使用 https://hc.apache.org/httpcomponents-client-ga/index.html


I need to upload images and txt files from my application to a remote server (Just http no ftp) using java. My application is in jsf framework. I searched but no suitable things found. Can anybody guide me? In fact I should upload files to special folder to remote server. I have two application with shared path to upload files, so for accessing them to this files, I decidec to upload shared files(such as images and texts) to third server. First application should upload files to this remote server and second application should read them from it. So my hard part of this solution is to upload files to this third server(in fact remote server) using http.

解决方案

To upload file to a specific folder, your server API must support that.

Server side for receiving uploaded files, you can use http://commons.apache.org/fileupload/

Client side for sending a file upload request, you can use https://hc.apache.org/httpcomponents-client-ga/index.html

这篇关于如何使用java将文件上传到http远程服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆