如何处理文件上传到专用图像服务器?

时间:2021-12-26 16:03:26

I got a webserver with a running application. There's a webpage with a form: some text data and a file upload field. Now, what I would like to have is it working like this:
The file is sent to the dedicated server, diffrent then the one application is running on. The server should return some kind of path (or anything that identifies the uploaded and saved file and allows to create an URL). Then, both this path and user-filled data should be submitted to the webserver with application, for any kind of database storage.

我有一个运行应用程序的网络服务器。有一个带有表单的网页:一些文本数据和一个文件上传字段。现在,我想要的是它的工作方式如下:文件被发送到专用服务器,然后运行一个应用程序。服务器应返回某种路径(或任何标识上载和保存文件并允许创建URL的内容)。然后,对于任何类型的数据库存储,应将此路径和用户填充的数据都提交给带有应用程序的Web服务器。

Problem is, there are 2 diffrent servers, so I can't upload the file with javascript, can I? Another way would be just to use iframe and put the upload form in there - but then I think I can't access the result of the upload (still inside the iframe) with javascript to pass the file path to my main server.

问题是,有2个不同的服务器,所以我无法用javascript上传文件,可以吗?另一种方法是使用iframe并将上传表单放在那里 - 但是我认为我无法使用javascript访问上传结果(仍然在iframe内)以将文件路径传递到我的主服务器。

I could also just upload the file to same server my application is running on and then just rsync it to the other one - but I'd like to avoid it if I can, trying to minimalize the traffic actually :)

我也可以将文件上传到运行我的应用程序的同一台服务器,然后将其同步到另一台 - 但我想尽可能避免它,试图最小化流量:)

How do you handle such thing in your applications?

你如何在你的应用程序中处理这样的事情?

2 个解决方案

#1


0  

POST to dedicated server, server stores image and calls back to web server through a web service or other to give it any info required.

POST到专用服务器,服务器存储图像并通过Web服务或其他方式回调给Web服务器,以便为其提供所需的任何信息。

#2


1  

If you used an iframe, you could submit the upload form to the dedicated image server, and in the case of a successful result, have it in turn load a page from the original server with the info (eg. image path) "passed along" as a GET parameter.

如果你使用了iframe,你可以将上传表单提交给专用的图像服务器,如果成功的结果,让它从原始服务器加载一个页面,其中包含信息(例如图像路径) “作为GET参数。

#1


0  

POST to dedicated server, server stores image and calls back to web server through a web service or other to give it any info required.

POST到专用服务器,服务器存储图像并通过Web服务或其他方式回调给Web服务器,以便为其提供所需的任何信息。

#2


1  

If you used an iframe, you could submit the upload form to the dedicated image server, and in the case of a successful result, have it in turn load a page from the original server with the info (eg. image path) "passed along" as a GET parameter.

如果你使用了iframe,你可以将上传表单提交给专用的图像服务器,如果成功的结果,让它从原始服务器加载一个页面,其中包含信息(例如图像路径) “作为GET参数。