File uploading and downloading method and device
By determining network information and pre-set rules to direct file uploads to appropriate storage locations, the method minimizes upload errors and interruptions, enhancing the efficiency of file storage and synchronization.
Patent Information
- Application Number
- CN202411202178.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-29
- Publication Date
- 2024-12-06
AI Technical Summary
Existing file uploading methods in cloud storage systems face high error probabilities due to long upload times and interruptions, leading to file damage or failure, especially for large files.
A method and device that determine network information and pre-set rules to direct file uploads to appropriate storage locations, allowing immediate partial storage and subsequent synchronization, reducing errors by minimizing upload interruptions.
This approach significantly reduces file upload errors by enabling quick storage and synchronization, improving efficiency and reducing the likelihood of file damage during interruptions.
Smart Images

Figure CN119094517A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data transmission, and in particular to a method and device for uploading and downloading files. Background Art
[0002] With the continuous development of the Internet, data information is generated all the time. In order to better transmit or utilize this data information, many companies are using their own data management systems (including software systems and network systems) to manage various file data. The preservation of data information is an indispensable and important part of data management. There are many ways to save data information. The most common way is to save this data information in files (which can be video files, audio files, picture files, document files, web page files, etc.) and save the files.
[0003] Normally, files are uploaded directly to a cloud storage system (a cloud storage system is an emerging network storage system based on cloud storage technology) for storage. However, since the entire file is uploaded during the uploading process, when the file is large, the upload time is long. If the upload is interrupted, it needs to be uploaded again, resulting in a longer upload time. Therefore, the probability of error is very high, which may cause file damage or upload failure. Summary of the invention
[0004] The embodiments of the present application provide a method and device for uploading and downloading files, so as to at least solve the error probability in the file uploading process in the prior art.
[0005] According to one aspect of an embodiment of the present application, a file uploading method is provided, including: obtaining an upload request for a target file, wherein the upload request is a request sent by a client upon receiving an upload trigger condition from a target user to a SaaS software system; determining network information to which the client is connected, and an upload rule corresponding to the target user according to the upload request, wherein the upload rule is a pre-set rule corresponding to an upload address; determining an upload address for the target file according to the network information and the upload rule; storing the upload address to a target storage location, and sending the upload address to the client, so that the client uploads the target file to a reference storage location according to the upload address; and synchronizing at least one file stored in the reference storage location to the target storage location according to a preset time period.
[0006] According to another aspect of an embodiment of the present application, a file download method is provided, including: obtaining a download request for a target file, wherein the download request is a request sent by a client upon receiving a download trigger condition from a target user, and the download trigger condition is a download trigger condition for data corresponding to the target file in a SaaS software system by the target user on the client; determining network information to which the client is connected and a download rule corresponding to the target user according to the download request, wherein the download rule is a pre-set rule corresponding to a download address; determining a download address for the target file according to the network information and the download rule; and sending the download address to the client so that the client downloads the target file according to a target download location corresponding to the download address.
[0007] According to another aspect of the embodiment of the present application, a file uploading device is also provided, including: an acquisition unit, used to acquire an upload request for a target file, wherein the upload request is a request sent by the client when receiving an upload trigger condition for a SaaS software system from a target user; a first determination unit, used to determine the network information of the client connection and the upload rules corresponding to the target user according to the upload request, wherein the upload rules are pre-set rules corresponding to the upload address; a second determination unit, used to determine the upload address of the target file according to the network information and the upload rules; a sending unit, used to store the upload address to a target storage location, and send the upload address to the client, so that the client uploads the target file to a reference storage location according to the upload address; a synchronization unit, used to synchronize at least one file stored in the reference storage location to the target storage location according to a preset time period.
[0008] Optionally, the above-mentioned second determination unit includes: a first determination subunit, used to determine the address corresponding to the first reference storage location as the upload address when the network information indicates that the network connected to the client is the first network and the upload rule indicates the first reference storage location, wherein the reference storage location includes the first reference storage location; a second determination subunit, used to determine the address corresponding to the second reference storage location as the upload address when the network information indicates that the network connected to the client is the first network and the upload rule indicates the second reference storage location, wherein the reference storage location includes the second reference storage location; a third determination subunit, used to determine the address corresponding to the second reference storage location as the upload address when the network information indicates that the network connected to the client is the second network.
[0009] Optionally, the above-mentioned file uploading device also includes a first acquisition unit, which is used to acquire a first data set corresponding to the first reference storage location and a second data set corresponding to the second reference storage location according to a first preset time period, wherein the first data set includes multiple first files and the second data set includes multiple second files; a first matching unit, which is used to match the first data set with the second data set to obtain a first matching result; a first screening unit, which is used to screen out multiple unmatched third files from the first data set when the first matching result indicates that the first data set does not match the second data set; and a first synchronization unit, which is used to synchronize the multiple third files to the second reference storage location and update the upload addresses of the multiple third files stored in the target storage location.
[0010] Optionally, the above-mentioned file uploading device also includes: a second acquisition unit, used to obtain a hotspot data set corresponding to a second reference storage location according to a second preset time period, wherein the hotspot data set includes multiple hotspot files, and the multiple hotspot files are files filtered out from multiple second files according to preset filtering rules; a second matching unit, used to match the hotspot data set with the first data set to obtain a second matching result; a second filtering unit, used to filter out multiple unmatched fourth files from the hotspot data set when the second matching result indicates that the hotspot data set does not match the first data set; a second synchronization unit, used to synchronize the multiple fourth files to the first reference storage location, and update the upload address of the multiple fourth files stored in the target storage location.
[0011] Optionally, the synchronization unit includes: an acquisition subunit, used to acquire the file names to be synchronized corresponding to each of the multiple files to be synchronized in the reference storage location according to a preset time period; a determination subunit, used to determine the file addresses corresponding to each of the files to be synchronized from the target storage location according to the multiple file names to be synchronized, wherein the file address is the upload address when the file to be synchronized is uploaded; a synchronization subunit, used to synchronize the multiple files to be synchronized to the storage locations corresponding to the corresponding file addresses according to the multiple file names to be synchronized.
[0012] According to another aspect of the embodiment of the present application, a file downloading device is also provided, including: an acquisition unit, used to obtain a download request for a target file, wherein the download request is a request sent by the client when receiving a download trigger condition of a target user, and the download trigger condition is a download trigger condition of the target user on the client for data corresponding to the target file in a SaaS software system; a first determination unit, used to determine the network information of the client connection and the download rules corresponding to the target user according to the download request, wherein the download rules are pre-set rules corresponding to the download address; a second determination unit, used to determine the download address of the target file according to the network information and the download rules; and a sending unit, used to send the download address to the client, so that the client downloads the target file according to the target download location corresponding to the download address.
[0013] Optionally, the second determination unit includes: a first determination subunit, used to determine the address corresponding to the first target storage location as the download address when the network information indicates that the network connected to the client is the first network and the download rule indicates the first target storage location; a second determination subunit, used to determine the address corresponding to the second target storage location as the download address when the network information indicates that the network connected to the client is the first network and the download rule indicates the second target storage location; a third determination subunit, used to determine the address corresponding to the first target storage location as the download address when the network information indicates that the network connected to the client is the first network, the download rule indicates the first target storage location and the second target storage location, and the target files are stored in both the first target storage location and the second target storage location; a fourth determination subunit, used to determine the address corresponding to the second target storage location as the download address when the network information indicates that the network connected to the client is the second network.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the above file uploading method or file downloading method.
[0015] According to another aspect of the embodiments of the present application, an electronic device is also provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor executes the above file upload method or file download method.
[0016] The above-mentioned file uploading method of the present application solves the problem of high error probability in the file uploading process in the prior art and reduces the error probability in the file uploading process. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 is a flow chart of an optional file uploading method according to an embodiment of the present invention;
[0019] Figure 2 is a schematic diagram of an optional file uploading method according to an embodiment of the present invention;
[0020] Figure 3 is a flow chart of an optional file downloading method according to an embodiment of the present invention;
[0021] Figure 4 It is a schematic diagram of an optional file downloading method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0023] Before introducing the technical solution of the present application, some terms involved in the present application are explained. The following related explanations can be combined with the technical solution of the embodiment of the present application at will, and they all belong to the protection scope of the embodiment of the present application. The embodiment of the present application includes at least part of the following contents:
[0024] DAM (Digital Asset Management): A system for storing, organizing, managing and distributing digital assets. These assets include images, videos, documents, design files and other multimedia content. DAM systems help companies centrally manage all their digital assets, enabling them to efficiently manage and optimize content;
[0025] SaaS (Software-as-a-Service): A model of providing software through the Internet, in which manufacturers deploy application software on their own servers. Customers can order the required application software services from manufacturers through the Internet according to their actual needs, pay the manufacturers according to the amount of services ordered and the length of time, and obtain the software application model provided by the manufacturers through the Internet;
[0026] DAS (Network Attached Storage): A dedicated data storage server. It is data-centric, completely separates storage devices from servers, and centrally manages data, thereby freeing up bandwidth, improving performance, reducing total cost of ownership, and protecting investment. Its cost is much lower than using server storage, while its efficiency is much higher than the latter;
[0027] OSS (Object Storage Service): A cloud storage service that provides massive, secure, low-cost, and highly reliable data storage solutions. It supports 99.9999999999% (12 9s) data persistence and 99.995% data availability, is suitable for storing any type of files, and supports elastic expansion of capacity and processing capabilities. OSS provides services to the outside world in the form of HTTP RESTful API, allowing users to store files in storage space through a standard RESTful API interface, and each file has a unique identifier. In addition, OSS also provides an access key (AccessKey) for identity authentication to ensure data security and access control. Alibaba Cloud Object Storage OSS is one of the largest online cloud storage services in China, with leading technology accumulation and a mature service system.
[0028] Resource manager (also called file resource manager): A system service that manages persistent or persistent data in a database, persistent message queue, or transactional file system. The resource manager stores data and performs failure recovery.
[0029] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0030] It should be noted that the embodiments in this application and all the required data in the embodiments are obtained and used by legitimate means with the consent of the user and relevant personnel, and the user's information security will be guaranteed during the acquisition and use process.
[0031] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0032] In order to solve the problem of high error rate in the file uploading process in the prior art, the present application provides a file uploading method. As an optional implementation method, please refer to Figure 1 , which shows a flowchart of a file uploading method according to an embodiment of the present application. The method comprises the following steps:
[0033] S102, obtaining an upload request for the target file, wherein the upload request is a request sent by the client upon receiving an upload trigger condition from the target user to the SaaS software system;
[0034] S104, determining network information of the client connection and an upload rule corresponding to the target user according to the upload request, wherein the upload rule is a pre-set rule corresponding to the upload address;
[0035] S106, determining the upload address of the target file according to the network information and the upload rule;
[0036] S108, storing the upload address in the target storage location, and sending the upload address to the client, so that the client uploads the target file to the reference storage location according to the upload address;
[0037] S110, synchronizing at least one file stored in a reference storage location to a target storage location according to a preset time period.
[0038] It should be noted that the file type of the target file in the above S102 can be various, such as video files, audio files, picture files, document files, web page files, lightweight data exchange format files (such as JSON files), design files, etc. The above upload request includes file attribute information corresponding to the file to be uploaded, and the file attribute information includes file size, current file location (file location in the client), file type, file occupied space, file creation time, file modification time, file access time, file access attributes, file permissions, etc.; the above upload trigger condition can be understood but not limited to as an upload trigger operation (for example, clicking the upload button, pressing Enter after selecting the target file, initiating an upload request according to a preset time period, etc.), and the above target user can be understood but not limited to as a user who initiates an upload request using a target account, and the above target account is the account corresponding to the client.
[0039] The client and SaaS are interdependent. The client provides users with an important way to directly access SaaS applications. SaaS is a software distribution model in which applications are hosted in the cloud and users access these applications through the Internet. The client is the interface for users to interact with SaaS applications. It allows users to input data, view reports, perform business operations, etc. The client makes SaaS services easier to use and access. The above upload request is a request from the user to upload a file to SaaS on the client. The various files (such as pictures) displayed in the SaaS system that users see on the client are files displayed in SaaS but stored in other storage locations.
[0040] The network information in the above S104 is used to indicate the network to which the client is connected. The network to which the client is connected can be determined by the server according to the IP address of the client carried in the upload request. The network to which the client is connected includes a first network and a second network. The first network can be understood as, but not limited to, a company intranet (a local area network or office network established within a company, which is connected by multiple computers through different network layouts to form a local office or resource sharing network. This type of network is usually limited to internal use within the company and can achieve file management, application software sharing, etc. The company intranet is a closed type and can be composed of two computers in an office, or it can be extended to thousands of computers in a company). The second network can be understood as, but not limited to, a company extranet. The extranet is a wide area network (WAN), also known as a public network, which is a remote network that connects computers in local area networks or metropolitan area networks in different regions. The extranet usually spans a large physical range, with a coverage range from tens of kilometers to thousands of kilometers. It can connect multiple regions, cities and countries, and even across several continents to provide long-distance communication services. The extranet is not the same as the Internet, but the extranet can be connected to the Internet and provide access to all content on the Internet.
[0041] The above upload rules can be pre-set according to business needs, for example, according to the user's identity information or according to the attribute information of the target file, such as the department to which the target user belongs in the company or the role the target user plays in the company.
[0042] The target storage location in S108 above can be understood as, but not limited to, a server resource manager (hereinafter referred to as a server or resource manager); the reference storage location is a storage location corresponding to the upload address, and the reference storage location includes a first reference storage location (which can be understood as, but not limited to, NAS) and a second reference storage location (which can be understood as, but not limited to, OSS). In the present application, NAS is a file storage device in the company's intranet, and OSS is a cloud file storage device. Each reference storage location corresponds to an upload address. The upload rule corresponding to the target user determined according to the upload request in S104 above can be understood as, but not limited to, determining the upload location (reference storage location) corresponding to the file according to the identity information of the target user; in the case where the first reference storage location is NAS and the second reference storage location is OSS, the upload rule is, for example: all files uploaded by the company's design department are uploaded to NAS, and all files uploaded by the company's development department are uploaded to OSS. The upload rule is set according to the attribute information of the target file, for example: files with a size less than or equal to 100M are uploaded to NAS, and files with a size greater than 100M are uploaded to OSS, etc.
[0043] The above S106 to S110 can be understood, but not limited to, as follows: after determining the upload address, the server will save it and send the upload address to the client, and the client will upload the target file to the reference storage location based on the received upload address; after the client uploads the target file to the reference storage location, the server can immediately synchronize the target file to the server (i.e., instant synchronization), or it can synchronize at least one file stored in the reference storage file to the server according to a preset time period.
[0044] It is understandable that after receiving the upload request and determining the upload address of the target file, the client will also rename the target file according to the attribute information corresponding to the target file carried in the upload request and the preset naming rules to obtain the target file name. When storing the upload address, the server will also synchronously store the target file name and the upload address in correspondence; similarly, when sending the upload address to the client, the target file name will also be sent synchronously, so that the client can store the target file to the reference storage location while sending the target file name and the attribute information corresponding to the target file to the reference storage location for corresponding storage with the target file.
[0045] Through the above-mentioned implementation mode of the present application, the target file can be quickly stored in the reference storage location first without waiting for the file to be completely stored in the server, which significantly reduces the burden on the server. Subsequently, the files in the reference storage location are gradually synchronized to the server, avoiding the problem of file damage or upload failure caused by upload interruption, and reducing the error rate during the file upload process.
[0046] As an optional implementation, determining the upload address of the target file according to the network information and the upload rule includes:
[0047] 1) when the network information indicates that the network connected to the client is a first network and the upload rule indicates a first reference storage location, determining an address corresponding to the first reference storage location as the upload address, wherein the reference storage location includes the first reference storage location;
[0048] 2) when the network information indicates that the network connected to the client is the first network and the upload rule indicates the second reference storage location, determining the address corresponding to the second reference storage location as the upload address, wherein the reference storage location includes the second reference storage location;
[0049] 3) When the network information indicates that the network to which the client is connected is the second network, an address corresponding to the second reference storage location is determined as the upload address.
[0050] The following combination Figure 2 The schematic diagram of the file upload method (upload process) shown in FIG. 1 specifically illustrates the method of determining the upload address as described above:
[0051] After the user triggers the file upload condition on the SaaS software system through the client, the client sends an upload request for the target file to the server (i.e. Figure 2 A1 or B1 shown in the figure, obtain the upload address and type), the server determines whether the client is connected to the company's intranet (i.e. the first network mentioned above) or the company's extranet (i.e. the second network mentioned above) according to the upload request. When it is determined that it is the company's intranet, there are two upload methods (i.e. Figure 2 A2.1: Upload files to NAS and A2.2: Upload files to OSS) are shown in the figure. At this time, one of the two upload methods is determined according to the specific upload rules. Figure 2 The A2.1 and A2.2 shown are automatically determined based on the upload rules (only one upload method will be selected), and the upload rules are set according to business needs, such as uploading files to NAS for IPs within a certain range, uploading files to OSS for IPs outside a certain range; or uploading files to NAS for certain designated users, and uploading files to OSS for other users, etc. When it is determined that it is the company's external network, there is only one upload method, such as Figure 2B2 shown: Upload files to OSS.
[0052] It can be understood that uploading a file to NAS or uploading a file to OSS is a process of actually storing the file in NAS or OSS and displaying it in SaaS after the upload is successful.
[0053] In today's Internet age, many companies are using DAM's SaaS to manage their assets (various file data). The upload and download speed of the SaaS software system depends on the company's public network bandwidth, which is basically around 3-4M / second. Some design companies' design source files or video files may be hundreds or thousands of MB, and it will take a long time to upload to the public network (3-4M / second). If the upload is interrupted, it needs to be uploaded again, which is time-consuming and laborious. You must wait for the upload to be completed before continuing the subsequent operations of the SaaS system, which affects work efficiency.
[0054] Through the above implementation of the present application, uploading files to NAS or OSS can not only quickly realize the uploading of files, but also, after the files are uploaded to NAS or OSS, the files will be displayed in the SaaS system, so that subsequent operations of the SaaS system can be continued, which greatly improves work efficiency.
[0055] As an optional implementation, Figure 2 As shown, the above-mentioned file upload method also includes a two-way synchronization between a first reference storage location (i.e., NAS) and a second reference storage location (i.e., OSS), specifically including two synchronization operations. The first synchronization operation: synchronizing all files in the NAS to the OSS, specifically including: S1, according to a first preset time period, obtaining a first data set corresponding to the first reference storage location and a second data set corresponding to the second reference storage location, wherein the first data set includes a plurality of first files, and the second data set includes a plurality of second files; S2, matching the first data set with the second data set to obtain a first matching result; S3, when the first matching result indicates that the first data set does not match the second data set, screening out a plurality of unmatched third files from the first data set; S4, synchronizing the plurality of third files to the second reference storage location, and updating the upload addresses of the plurality of third files stored in the target storage location.
[0056] It should be noted that the operation in S1 above can be understood, but not limited to, as obtaining all files stored in the first reference storage location (i.e., the multiple first files) and all files stored in the second reference storage location (i.e., the multiple second files); the matching operation in S2 above can be understood, but not limited to, as pairing multiple first files with multiple second files, determining whether the multiple first files stored in the first reference storage location are also stored in the second reference storage location, and in the case that the multiple first files are all included in the multiple second files, determining that the first data set matches the second data set, and in the case that there is a file in the multiple first files that is not included in the multiple second files, determining that the first data set does not match the second data set; the specific matching method can be matching based on the file name (when each file is uploaded, the server will rename the uploaded file according to the preset naming rule and return it to the client when returning the upload address, so each uploaded file will have an independent and unique file name, which can avoid file duplication and reduce the complexity of the matching process when performing file matching operations. When the client uploads the file, it will synchronously send the file name to the reference storage location for storage). Therefore, the operations in S2 to S3 above may specifically include the following steps:
[0057] A file is selected from multiple first files as the current file. The selection operation can be but is not limited to being understood as selecting a file name from the file names corresponding to each of the multiple first files as the current file name; the current file name is paired with the file names corresponding to each of the multiple second files. If there is a file name that is the same as the current file name among the file names corresponding to each of the multiple second files, it can be determined that the same first file is stored in both the first reference storage location and the second reference storage location. At this time, the same file name can be paired with the current file name as the target file name; if there is no file name that is the same as the current file name among the file names corresponding to each of the multiple second files, the first file corresponding to the current file name is determined as the third file; and a file name is selected from the file names corresponding to each of the multiple first files except the current file name as the current file name.
[0058] Through the operations in S2 to S3 above, multiple third files that are not stored in the second reference storage location can be screened out from the first reference storage location, so that multiple third files can be synchronously stored in the second reference storage location. The upload addresses of the multiple third files stored in the above-mentioned updated target storage location can be understood, but not limited to, as follows: after the server determines the upload address and renames the target file, it will store the upload address and the renamed file name in the server accordingly. After synchronizing the file stored in the first reference storage location to the second reference storage location, the file will have two upload addresses at the same time, so the server will also store the upload address corresponding to the file in the second reference storage location, that is, the upload address corresponding to the first reference storage location and the upload address corresponding to the second reference storage location of the file will be synchronously stored, and the two upload addresses will exist at the same time and will not be overwritten.
[0059] The second synchronization operation: synchronizing the hotspot files in OSS to NAS, specifically includes: S1, according to the second preset time period, obtaining the hotspot data set corresponding to the second reference storage location, wherein the hotspot data set includes multiple hotspot files, and the multiple hotspot files are files filtered out from multiple second files according to preset filtering rules; S2, matching the hotspot data set with the first data set to obtain a second matching result; S3, when the second matching result indicates that the hotspot data set does not match the first data set, filtering out multiple unmatched fourth files from the hotspot data set; S4, synchronizing the multiple fourth files to the first reference storage location, and updating the upload addresses of the multiple fourth files stored in the target storage location.
[0060] It should be noted that, in order to avoid conflicts in synchronization operations, the second preset time period in the above S1 is set to a time period different from the time length of the first preset time period in the present application. At the same time, when the end timestamp of the second preset time period is the same as the end timestamp of the first preset time period, the present application will extend the current second preset time period, so that the end timestamp of the second preset time period is different from the end timestamp of the first preset time period, but the extension is only performed when the end timestamp of the second preset time period is the same as the end timestamp of the first preset time period, and the hotspot files in the OSS are synchronized to the NAS according to the extended second preset time period. After that, the hotspot files in the OSS are synchronized to the NAS according to the original (unextended) second preset time period.
[0061] The operation in S1 above can be understood, but not limited to, as filtering out multiple hot files from multiple second files according to preset filtering rules. For example, the above filtering rules are: a second file with a download volume of 100 within a preset time period (for example, within one day) is a hot file; or a file uploaded by the R&D department is a hot file; or a file displayed in the SaaS software system is edited 10 times on the client within a preset time period (for example, within one day) as a hot file, etc. The specific filtering rules for hot files can be set according to business needs; the matching operation in S2 above can be understood, but not limited to, as pairing multiple hot files with multiple first files, determining whether multiple hot files stored in the second reference storage location are also stored in the first reference storage location, and when multiple hot files are all included in multiple first files, determining that the hot data set matches the first data set, and when there are multiple hot files that are not included in multiple first files, determining that the hot data set does not match the first data set; the specific matching method can be matching based on the file name (the specific description of the file name above is not repeated here), therefore: the operations in S2 to S3 above may specifically include the following steps:
[0062] A hotspot file is selected from multiple hotspot files as the current hotspot file. The selection operation can be but is not limited to being understood as selecting a hotspot file name from the hotspot file names corresponding to each of the multiple hotspot files as the current hotspot file name; pairing the current hotspot file name with the file names corresponding to each of the multiple first files. If there is a file name that is the same as the current hotspot file name among the file names corresponding to each of the multiple first files, it can be determined that the same hotspot file is stored in both the first reference storage location and the second reference storage location. At this time, the same file name can be paired with the current hotspot file name as the target file name; if there is no file name that is the same as the current hotspot file name among the file names corresponding to each of the multiple first files, the hotspot file corresponding to the current hotspot file name is determined as the fourth file; selecting a file name from the file names corresponding to each of the multiple first files except the current hotspot file name as the current hotspot file name.
[0063] Through the operations in S2 to S3 above, multiple fourth files that are not stored in the first reference storage location can be screened out from the second reference storage location, so that multiple fourth files can be synchronously stored in the first reference storage location. The upload addresses of the multiple fourth files stored in the above-mentioned updated target storage location can be understood, but not limited to, as follows: after the server determines the upload address and renames the target file, it will store the upload address and the renamed file name in the server accordingly. After synchronizing the fourth file stored in the second reference storage location to the first reference storage location, the fourth file will have two upload addresses at the same time, so the server will also store the upload address corresponding to the fourth file in the first reference storage location, that is, the upload address corresponding to the first reference storage location and the upload address corresponding to the second reference storage location of the fourth file will be synchronously stored, and the two upload addresses will exist at the same time and will not be overwritten.
[0064] By synchronizing the files stored in the first reference storage location to the second reference storage location through the above-mentioned synchronization of the files stored in the first reference storage location of the present application, users connected to the company's external network can quickly download files when needed. By synchronizing the hot files stored in the second reference storage location to the first reference storage location, it can be ensured that internal personnel of the company can download them from the local NAS at a very fast speed when they need to download.
[0065] As an optional implementation, the above-mentioned synchronization of at least one file stored in the reference storage location to the target storage location according to a preset time period includes: S1, obtaining the file names to be synchronized corresponding to each of the multiple files to be synchronized in the reference storage location according to the preset time period; S2, determining the file addresses corresponding to each of the files to be synchronized from the target storage location according to the multiple file names to be synchronized, wherein the file address is the upload address when the file to be synchronized is uploaded; S3, synchronizing the multiple files to be synchronized to the storage locations corresponding to the corresponding file addresses according to the multiple file names to be synchronized.
[0066] The specific operations in the above S1 include: according to a preset time period, obtaining first file names corresponding to multiple first files from a first reference storage location, and obtaining second file names corresponding to multiple second files to be synchronized from a second reference storage location; obtaining storage file names corresponding to multiple target storage files from a target storage location (which can be but is not limited to being understood as a server); filtering out first file names to be synchronized that do not match any of the multiple storage file names from the multiple first file names (i.e., there is no first file name identical to it in the multiple storage file names), and filtering out second file names to be synchronized that do not match any of the multiple storage file names from the multiple second file names (i.e., there is no second file name identical to it in the multiple storage file names), wherein the multiple file names to be synchronized include multiple first file names to be synchronized and multiple second file names to be synchronized.
[0067] The operation in the above S2 can be but is not limited to being understood as determining the file address corresponding to each file to be synchronized stored in the target storage location (i.e., after determining the upload address of the file, the upload address stored in the target storage location corresponding to the stored file name), and the operation in S2 specifically includes: determining the file address corresponding to each first file to be synchronized (the file corresponding to the first file name to be synchronized) from the target storage location according to multiple first file names to be synchronized; determining the file address corresponding to each second file to be synchronized (the file corresponding to the second file name to be synchronized) from the target storage location according to multiple second files to be synchronized.
[0068] Each file address corresponds to a storage location in the target storage location. The operations in S2 to S3 above can be understood, but are not limited to, as determining the file addresses corresponding to the multiple files to be synchronized according to the multiple names of the files to be synchronized, and then synchronizing the multiple files to be synchronized from the reference storage location to the storage location corresponding to each file address. It can be understood that in the case where the file to be synchronized corresponds to two file addresses (that is, the file to be synchronized is stored in both the first reference storage location and the second reference storage location), the storage location corresponding to any one of the two file addresses can be selected to store the file to be synchronized (because the file address is stored corresponding to the file name, therefore, in essence, each file name corresponds to a storage location in the target storage location, so even if the file to be synchronized has two file addresses, they correspond to the same storage location).
[0069] Through the above implementation of the present application, a backup operation of files can be implemented, that is, when the files stored in the first reference storage location and / or the second reference storage location are damaged, the corresponding files can also be found from the server.
[0070] In the prior art, when files are directly uploaded to a server for storage, it takes a long time for internal company personnel to download large files from the server. Therefore, the problem of long download time in the prior art is not solved. This application provides a file download method. As an optional implementation method, please refer to Figure 3 , which shows a flowchart of a file downloading method according to an embodiment of the present application, the method comprising the following steps:
[0071] S302, obtaining a download request for the target file, wherein the download request is a request sent by the client upon receiving a download trigger condition from the target user, and the download trigger condition is a download trigger condition for the target user to download data corresponding to the target file in the SaaS software system on the client;
[0072] S304, determining network information to which the client is connected and a download rule corresponding to the target user according to the download request, wherein the download rule is a pre-set rule corresponding to the download address;
[0073] S306, determining the download address of the target file according to the network information and the download rule;
[0074] S308: Send the download address to the client, so that the client downloads the target file according to the target download location corresponding to the download address.
[0075] It should be noted that the target file in S302 can be of multiple file types, such as the file type in the file upload method, and the file attribute information included in the specific download request, such as the file attribute information in the file upload method, which will not be described in detail in this application. The operation in S302 can be understood, but not limited to, as the target user triggers a download operation (i.e., download trigger condition) on a file in SaaS on the client, and the client sends a file download request to the server; the target user can be understood, but not limited to, as a user who initiates a download request using a target account, and the target account is the account corresponding to the client.
[0076] The above network information is the network to which the client is connected, specifically including the first network (which can be understood as, but not limited to, the company's intranet) and the second network (which can be understood as, but not limited to, the company's extranet). For a detailed introduction to the intranet and the extranet, please refer to the relevant description in the above file upload method, and this application will not repeat them here. The above download rules can be flexibly set according to business needs, for example, they can be pre-set according to the user's identity information or set according to the attribute information of the target file, such as the target user's department in the company or the role the target user plays in the company.
[0077] The target download location in the above S308 specifically includes a first download location (which may be understood as, but not limited to, NAS) and a second download location (which may be understood as, but not limited to, OSS). However, when the target file is stored in the first download location and / or the second download location, the target download location in this application does not include the server. Only when the target file is not stored in the first download location and the second download location, the storage location corresponding to the server is considered. Each download location corresponds to a download address. The download rule corresponding to the target user determined according to the download request in the above S304 may be a download rule corresponding to the target user determined according to the identity information of the target user, or may be a download rule determined according to the attribute information of the file. The above determination of the download rule may be but is not limited to being understood as determining the target download location corresponding to the target file; in the case where the above first download location is NAS, the second download location is OSS, and the download rule is a rule determined according to the identity information of the target user, in the above download rule, for example: the company's design department downloads files from NAS, and the company's development department downloads files from OSS; in the case where the above first download location is NAS, the second download location is OSS, and the download rule is a rule determined according to the attribute information of the file, in the above download rule, for example: files with a size greater than or equal to 100M are downloaded from NAS, and files with a size less than 100M are downloaded from OSS; it can be understood that the specific determination method of the above download rules is only two examples in the present application, and the download rules can be flexibly personalized according to business needs.
[0078] Through the above implementation of the present application, it is possible to control the downloading of corresponding files from different target download locations, greatly improving the efficiency of downloading files.
[0079] As an optional implementation mode, determining the download address of the target file according to the network information and the download rule includes:
[0080] 1) When the network information indicates that the network connected to the client is a first network and the download rule indicates a first target storage location, an address corresponding to the first target storage location is determined as the download address;
[0081] 2) when the network information indicates that the network connected to the client is the first network and the download rule indicates the second target storage location, determining the address corresponding to the second target storage location as the download address;
[0082] 3) when the network information indicates that the network connected to the client is the first network, and the download rule indicates the first target storage location and the second target storage location, and the target file is stored in both the first target storage location and the second target storage location, the address corresponding to the first target storage location is determined as the download address;
[0083] 4) When the network information indicates that the network to which the client is connected is the second network, the address corresponding to the second target storage location is determined as the download address.
[0084] The following combination Figure 4 The schematic diagram of the file downloading method (download process) shown in FIG. 1 specifically illustrates the above method of determining the download address:
[0085] After the user triggers the download trigger condition for the target file on the SaaS system through the client, the client sends a download request for the target file to the server (i.e. Figure 4 A1 or B1 shown in the figure, obtain the download address), the server determines whether the client is connected to the company's intranet (i.e. the first network mentioned above) or the company's extranet (i.e. the second network mentioned above) according to the download request. If it is determined to be the company's intranet, there are two download methods (i.e. Figure 4 A2.1: download files from NAS and A2.2: download files from OSS) are shown. At this time, a download method is determined from the two download methods according to the specific download rules. Figure 4 The A2.1 and A2.2 shown are automatically determined based on the download rules (only one download method will be selected), and the download rules are set according to business needs, such as downloading files from NAS for IPs within a certain range, and downloading files from OSS for IPs outside a certain range; or some designated users download files from NAS, and other users download files from OSS, etc.; in the case of determining that it is the company's extranet, there is only one download method, that is, Figure 4 B2 shown: Download files from OSS. When the download address determined according to the network information and download rules is two download addresses (the download address corresponding to the first target storage location and the download address corresponding to the second target storage location), the server will give priority to sending the download address corresponding to the first target storage location to the client, that is, the file in NAS is selected first. If the file in the first target storage location does not exist yet, the server will send the download address corresponding to the second target storage location to the client, that is, the file address of OSS is taken for download.
[0086] That is to say, the above-mentioned determination of the download address also includes: when the network information indicates that the network connected to the client is the first network, and the download rule indicates the first target storage location and the second target storage location, and the first target storage location does not store the target file, and the second target storage location stores the target file, the address corresponding to the second target storage location is determined as the download address.
[0087] Through the above implementation of the present application, the most suitable downloading method can be determined according to the file download requests sent by different networks and different users, thereby greatly improving the file downloading efficiency.
[0088] The following combination Figure 2 and Figure 4 The above-mentioned file upload method and file download method are described in general, including: This application uses NAS and OSS as the intermediate storage space for SaaS file upload or download to achieve a fast upload or download experience. It is mainly divided into two processes: upload process and download process:
[0089] Upload process: Figure 2 As shown, a client connected to the company's intranet or extranet initiates a request to upload a target file to the server (i.e., Figure 2 A1 or B1 shown: Get upload address); The server determines whether the client is connected to the company's intranet or the company's extranet (client's network information) based on the client's request IP; When it is determined that the client is connected to the company's intranet, the company can decide whether the corresponding person requests to upload the file or the corresponding file to NAS or OSS based on the configuration (upload rule), for example: All the design department personnel of the company upload to NAS to avoid affecting their subsequent work due to slow upload. All the development department personnel of the company upload to OSS; If the client obtains the upload address of NAS, the file is uploaded to NAS and the file information is inserted into the resource manager (that is, the server saves the upload address and the file's attribute information accordingly); If the client obtains the upload address of OSS, the file is uploaded to OSS and the file information is inserted into the resource manager (that is, the server saves the upload address and the file's attribute information accordingly). When it is determined that the client is connected to the company's extranet, the client obtains the upload address of OSS, the file is uploaded to OSS and the file information is inserted into the client manager (that is, the server saves the upload address and the file's attribute information accordingly).
[0090] Files uploaded to NAS will be synchronized to the corresponding directory of OSS at regular intervals, and the synchronization status of the resource manager will be updated (that is, the file address of the file stored in the server will be updated, and the synchronization status of the file will be updated to see whether it is synchronized to OSS); the server will also control NAS to periodically pull hot files from OSS (set according to needs, such as all files uploaded within 5 days are hot files, or files downloaded more than or equal to 20 times are hot files, or files uploaded by the design department are hot files, etc.), and update the synchronization status of the resource manager (that is, the file address of the file stored in the server will be updated, and the synchronization status of the file will be updated to see whether it is synchronized to NAS), ensuring that when internal company personnel need to download, they can download from the local NAS at extremely fast speed.
[0091] The resource manager is equipped with a timer, which will periodically check whether the files in the NAS have been synchronized to the OSS. If they have been synchronized, the status (synchronization status) and file address will be checked to see if they have been updated. At the same time, it will check whether the hot files in the OSS have been synchronized to the NAS. If they have been synchronized, the status (synchronization status) and file address will be checked to see if they have been updated. The specific check can be performed by file name (i.e., the file name obtained by renaming the file each time the upload address is determined).
[0092] Through the above file uploading method, the error probability in the file uploading process is greatly reduced, and the file uploading efficiency is improved.
[0093] Download process:
[0094] like Figure 4 As shown, a client connected to the company's intranet or extranet initiates a download request for a target file to the server (i.e., Figure 4 A1 or B1 shown: Get download address); the server can determine whether the client is connected to the company intranet or the company extranet (client network information) based on the client's request IP; when it is determined that the client is connected to the company intranet (first network), the server will judge and return the download address of NAS or OSS based on the configured conditions (i.e. download rules), for example: all the design department personnel of the company download files from NAS, and all the development department personnel of the company download files from OSS; if the client obtains the download address of NAS, the file is downloaded from NAS according to the download address direct intranet mode (using the first network); if the client obtains the download address of OSS, the file is downloaded from OSS according to the download address direct extranet mode (using the second network). When it is determined that the client is connected to the company extranet, the server will return the download address of OSS to the client, and the client will download the file from OSS according to the download address direct extranet mode (using the second network).
[0095] Through the above file downloading method, the file downloading efficiency is greatly improved.
[0096] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0097] According to another aspect of an embodiment of the present invention, a file uploading device is further provided, the device comprising:
[0098] An acquisition unit, used to acquire an upload request for a target file, wherein the upload request is a request sent by the client upon receiving an upload trigger condition from a target user to the SaaS software system;
[0099] A first determining unit, configured to determine network information of the client connection and an upload rule corresponding to the target user according to the upload request, wherein the upload rule is a pre-set rule corresponding to the upload address;
[0100] A second determining unit, used to determine an upload address of a target file according to network information and an upload rule;
[0101] A sending unit, used to store the upload address in a target storage location, and send the upload address to the client, so that the client uploads the target file to the reference storage location according to the upload address;
[0102] The synchronization unit is used to synchronize at least one file stored in the reference storage location to the target storage location according to a preset time period.
[0103] According to another aspect of an embodiment of the present invention, a file downloading device is provided, the device comprising:
[0104] An acquisition unit, configured to acquire a download request for a target file, wherein the download request is a request sent by the client upon receiving a download trigger condition from a target user, and the download trigger condition is a download trigger condition for data corresponding to the target file in the SaaS software system by the target user on the client;
[0105] A first determining unit, configured to determine network information to which the client is connected and a download rule corresponding to a target user according to a download request, wherein the download rule is a pre-set rule corresponding to a download address;
[0106] A second determining unit, used to determine a download address of a target file according to network information and download rules;
[0107] The sending unit is used to send a download address to the client, so that the client can download the target file according to the target download location corresponding to the download address.
[0108] The specific manner in which each unit in the above device embodiment performs operations has been described in detail in the embodiment of the method, and will not be elaborated on again here.
[0109] According to another aspect of an embodiment of the present invention, an electronic device for implementing the above-mentioned file upload method or file download method is also provided, and the electronic device may be a terminal device or a server. This embodiment is illustrated by taking the electronic device as a terminal device as an example. The electronic device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program executable by at least one processor, and the computer program is executed by at least one processor so that at least one processor performs the steps in any one of the above-mentioned method embodiments. The above-mentioned electronic device may be located in at least one network device among a plurality of network devices of a computer network. The above-mentioned processor may be configured to execute the steps of the above-mentioned file upload method or file download method through a computer program.
[0110] The memory can be used to store software programs and modules, such as program instructions / modules corresponding to the file upload and download methods and devices in the embodiments of the present invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, implementing the above-mentioned file upload method or file download method. The memory can be specifically but not limited to being used to store the data involved in the above-mentioned file upload method or file download method.
[0111] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0112] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0113] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned file upload method or file download method. The above-mentioned computer-readable storage medium can be configured to store a computer program for executing each step of the above-mentioned file upload method or file download method.
[0114] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0115] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A file uploading method, characterized in that: include: Obtaining an upload request for the target file, wherein the upload request is a request sent by the client upon receiving an upload trigger condition from the target user to the SaaS software system; Determine network information of the client connection and an upload rule corresponding to the target user according to the upload request, wherein the upload rule is a pre-set rule corresponding to the upload address; Determine the upload address of the target file according to the network information and the upload rule; storing the upload address in a target storage location, and sending the upload address to the client, so that the client uploads the target file to a reference storage location according to the upload address; According to a preset time period, at least one file stored in the reference storage location is synchronized to the target storage location.
2. The method according to claim 1, characterized in that Determining the upload address of the target file according to the network information and the upload rule includes: When the network information indicates that the network connected to the client is a first network and the upload rule indicates a first reference storage location, determining an address corresponding to the first reference storage location as the upload address, wherein the reference storage location includes the first reference storage location; When the network information indicates that the network connected to the client is the first network, and the upload rule indicates a second reference storage location, determining an address corresponding to the second reference storage location as the upload address, wherein the reference storage location includes the second reference storage location; When the network information indicates that the network to which the client is connected is the second network, an address corresponding to the second reference storage location is determined as the upload address.
3. The method according to claim 2, characterized in that Also includes: According to a first preset time period, acquiring a first data set corresponding to the first reference storage location and a second data set corresponding to the second reference storage location, wherein the first data set includes a plurality of first files, and the second data set includes a plurality of second files; Performing a matching operation on the first data set and the second data set to obtain a first matching result; When the first matching result indicates that the first data set does not match the second data set, screening out a plurality of third files that do not match from the first data set; The plurality of third files are synchronized to the second reference storage location, and the upload addresses of the plurality of third files stored in the target storage location are updated.
4. The method according to claim 3, characterized in that: Also includes: According to a second preset time period, obtaining a hotspot data set corresponding to the second reference storage location, wherein the hotspot data set includes a plurality of hotspot files, and the plurality of hotspot files are files screened out from the plurality of second files according to a preset screening rule; Performing a matching operation on the hotspot data set and the first data set to obtain a second matching result; When the second matching result indicates that the hotspot data set does not match the first data set, screening out a plurality of unmatched fourth files from the hotspot data set; The plurality of fourth files are synchronized to the first reference storage location, and the upload addresses of the plurality of fourth files stored in the target storage location are updated.
5. The method according to claim 1, characterized in that Synchronizing at least one file stored in the reference storage location to the target storage location according to a preset time period, including: According to a preset time period, obtaining the names of the files to be synchronized corresponding to the multiple files to be synchronized in the reference storage location; Determining the file address corresponding to each of the files to be synchronized from the target storage location according to the names of the files to be synchronized, wherein the file address is the upload address when the files to be synchronized are uploaded; According to the names of the multiple files to be synchronized, the multiple files to be synchronized are synchronized to storage locations corresponding to the respective corresponding file addresses.
6. A file downloading method, characterized in that: include: Obtain a download request for the target file, wherein the download request is a request sent by the client upon receiving a download trigger condition from the target user, and the download trigger condition is a download trigger condition for the target user to download data corresponding to the target file in the SaaS software system on the client; Determine network information of the client connection and download rules corresponding to the target user according to the download request, wherein the download rules are pre-set rules corresponding to the download address; Determine the download address of the target file according to the network information and the download rule; The download address is sent to the client, so that the client downloads the target file according to the target download location corresponding to the download address.
7. The method according to claim 6, characterized in that Determining the download address of the target file according to the network information and the download rule includes: When the network information indicates that the network connected to the client is a first network and the download rule indicates a first target storage location, determining an address corresponding to the first target storage location as the download address; When the network information indicates that the network connected to the client is the first network, and the download rule indicates a second target storage location, determining an address corresponding to the second target storage location as the download address; When the network information indicates that the network connected to the client is the first network, and the download rule indicates the first target storage location and the second target storage location, and the target file is stored in both the first target storage location and the second target storage location, an address corresponding to the first target storage location is determined as the download address; When the network information indicates that the network to which the client is connected is a second network, an address corresponding to the second target storage location is determined as the download address.
8. A file uploading device, characterized in that: include: An acquisition unit, configured to acquire an upload request for a target file, wherein the upload request is a request sent by the client upon receiving an upload trigger condition from a target user to the SaaS software system; A first determining unit, configured to determine network information to which the client is connected and an upload rule corresponding to the target user according to the upload request, wherein the upload rule is a pre-set rule corresponding to the upload address; A second determining unit, configured to determine an upload address of the target file according to the network information and the upload rule; A sending unit, configured to store the upload address in a target storage location, and send the upload address to the client, so that the client uploads the target file to a reference storage location according to the upload address; The synchronization unit is used to synchronize at least one file stored in the reference storage location to the target storage location according to a preset time period.
9. A file downloading device, characterized in that: include: An acquisition unit, configured to acquire a download request for a target file, wherein the download request is a request sent by the client upon receiving a download trigger condition from a target user, wherein the download trigger condition is a download trigger condition for data corresponding to the target file in a SaaS software system by the target user on the client; A first determining unit, configured to determine network information to which the client is connected and a download rule corresponding to the target user according to the download request, wherein the download rule is a pre-set rule corresponding to the download address; A second determining unit, configured to determine a download address of the target file according to the network information and the download rule; The sending unit is used to send the download address to the client, so that the client downloads the target file according to the target download location corresponding to the download address.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the file uploading method described in any one of claims 1 to 5, or the file downloading method described in any one of claims 6 to 7.
