Large file upload FTP

need

Upload local large files to the FTP server through the browser.

original method

Upload the entire local file to the browser, then send it to the node server, and finally send it to the FTP server by node.

There is a problem

The browser cache is limited and the upload rate is affected by the network speed. When the file is too large, it cannot be uploaded.

ways to improve

The browser reads the size of the local file, then divides the file into blocks, reads it to the browser in blocks, sends it to the node server, and stores it on the node server. When all the blocks of the file are sent to the node server, the file is then Assemble, and finally send the file to the FTP server by node.

Document completeness check

Throws an exception when a file block is not uploaded successfully or is missed.

file stream

 

Upload process

(1) Click the upload file in the browser, a file selection box will pop up, and select the local file.

(2) The browser reads the local file size, and reads the file in blocks according to the set block size.

(3) The browser sends the read file block to the node server, and the node server stores the file.

(4) When all the file blocks are sent, the node service assembles all the file blocks to form a completed file, and then sends it to the FTP server.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326275963&siteId=291194637