Recently idle boring, time to implement a simple file storage system, the use of FTP functions, can be stored in different file servers.
Git url:https://git.oschina.net/lkclkc88/filestore.git
The basic principle of implementation is to generate a random name (UUID), and then the file name to do a fragmented (fragmented number) hash, to calculate the file storage fragmentation, and then through the FTP node configuration to find fragmented storage FTP location, through the FTP client, upload files to the FTP server, The storage path is {rootpath}/{yyyy_mm}/fragment/filename. and play the file path
Download is the same rule, through the file path to find the location of the FTP node storage, and finally through the FTP node to download files.
It may be more efficient to provide file downloads on an FTP server, by installing Nginx/apache, in actual use.