search

Home  >  Q&A  >  body text

JAVA 怎么实现跨域上传文件

如题,比如说我在192.168.1.1服务器上上传一个图片,后台接收图片后把图片存到192.168.2.2服务器上


根据各位大牛的回答,我知道的实现方式有两种
一是1服务器上的服务嵌套2服务器的页面,上传之后自动到2服务器上,但是这种要维护两个服务器的服务。
二是1服务器上上传的文件通过scp到2服务器上,但是需要2服务器的用户名、密码,密码明文感觉不太安全,还需要一套加密的东西。

黄舟黄舟2888 days ago535

reply all(3)I'll reply

  • 巴扎黑

    巴扎黑2017-04-18 10:31:28

    Your problem is about transferring files between two servers.

    There are so many ways to transfer files, such as HTTPFTP.

    The simplest and most common way is HTTP. If you have other special needs, you should choose a plan based on your needs.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:31:28

    1. You can write an http access function in the background. When someone uploads a picture to server 1, I use this module of http access to request server 2 to upload it. In fact, it is the process of simulating a human request
    2. You can open a share on server 2, and after uploading successfully on server 1, copy it directly to server 2

    reply
    0
  • PHPz

    PHPz2017-04-18 10:31:28

    Can’t you just forward it directly

    reply
    0
  • Cancelreply