V
V
Victor Smolsky2020-05-29 21:09:45
PHP
Victor Smolsky, 2020-05-29 21:09:45

How to correctly implement the upload of large files from one server to another?

Good afternoon.
The project consists of two servers: front with Internet access and a server with a database and files without the Internet. The servers are on the same subnet and have access to each other.
The task is to upload large files from the front to the file server via the web interface.
Implemented in PHP, Javascript as follows:

  • The file is loaded via javascript in parts, for example, 5 megabytes each, each part is immediately transferred to the file server, where it is assembled into a single script file by the loader.
  • The process of transferring a file to the file server is as follows: The file is uploaded to the front in the tmp folder, from where a request is sent via http to the loader script on the file server to copy the temporary file to itself (get_file_contents). Upon completion of copying, the file one issues json with data about the file and status, the tmp file is deleted.


Everything would be fine, but the process of copying, for example, 5 MB, takes 13-20 seconds, which is very long when downloading, for example, a 2 GB file.

Tell me, please, alternative options (algorithms) for such a download?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question