A file upload method, system, device, and storage medium

By using the server as a relay station for the file stream and directly forwarding the file stream to the recipient, the problems of long transmission time and insufficient storage space in traditional file upload methods are solved, and an efficient and stable file upload process is achieved.

CN116546003BActive Publication Date: 2026-04-17JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2023-05-12
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Traditional file upload methods require caching files on the server, resulting in long file transfer times and insufficient server storage space, which affects the stability of business systems.

Method used

The server acts as a relay station for file streams, directly forwarding the file streams to the recipients, avoiding caching files on the server side, and using a template design pattern with hooks to handle the upload logic of different recipients.

Benefits of technology

It improved file upload efficiency, reduced server storage pressure, and made the business system more robust and easier to use.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116546003B_ABST
    Figure CN116546003B_ABST
Patent Text Reader

Abstract

This invention discloses a file upload method, comprising the following steps: receiving a first request from a requester including upload parameters; storing the upload parameters in a cache and feeding back an identifier corresponding to the upload parameters to the requester; receiving a second request from the requester including the identifier and multiple files to be uploaded; obtaining the upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters. This invention also discloses a system, a computer device, and a readable storage medium. The proposed solution treats the server as a file stream relay station, directly forwarding the stream to the receiver, greatly improving file upload efficiency and cloud platform usability; moreover, by not caching the files to be uploaded on the server, it eliminates the risk of insufficient storage space on the server due to too many or too large uploaded files, making the business system more robust.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of file processing, and more specifically to a file upload method, system, device, and storage medium. Background Technology

[0002] When uploading files, traditional and popular file upload technologies (including chunked upload) require caching the file on the server before uploading. Specifically, the file is first uploaded to the cloud platform's server, and then uploaded from the cloud platform's server to the virtualization platform. In other words, the data stream contains both parameters and selected files. After receiving the data stream, the server caches the parameters in the stream in memory and caches the files in the stream on the server to form a temporary file. Then, when the business layer uploads, it retrieves the parameters from memory and the file stream from the temporary file to execute the upload task.

[0003] However, the drawbacks of this upload method are obvious. First, the file stream is uploaded twice: once from the user's local machine to the server, and once from the server to the virtualization platform. If the file is large, these two transfers waste a lot of time. Second, the file needs to be cached on the server. Although it is deleted after the upload is complete, if many users upload multiple files simultaneously, the server's hard drive space will be filled, affecting normal business operations. Summary of the Invention

[0004] In view of this, in order to overcome at least one aspect of the above problems, embodiments of the present invention propose a file upload method, comprising the following steps:

[0005] Receive the first request sent by the requester, which includes upload parameters;

[0006] The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester.

[0007] Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded;

[0008] Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient in turn based on the upload parameters.

[0009] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0010] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0011] The hook method to be invoked is determined based on the type of the receiver.

[0012] In some embodiments, it also includes:

[0013] Set up multiple hook methods, each corresponding to a different receiver.

[0014] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0015] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0016] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0017] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0018] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0019] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0020] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0021] In some embodiments, it also includes:

[0022] Monitor the upload progress.

[0023] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a file upload system, including:

[0024] The first receiving module is configured to receive a first request sent by the requester, including upload parameters;

[0025] The feedback module is configured to store the upload parameters in a cache and send the identifier corresponding to the upload parameters back to the requester.

[0026] The second receiving module is configured to receive a second request sent by the requester, which includes the identifier and multiple files to be uploaded;

[0027] The forwarding module is configured to obtain the upload parameters in the cache based on the identifier in the second request and forward each file to be uploaded to the receiver in sequence based on the upload parameters.

[0028] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a computer device, comprising:

[0029] At least one processor; and

[0030] A memory storing a computer program that can run on the processor, wherein the processor executes the program and performs the following steps:

[0031] Receive the first request sent by the requester, which includes upload parameters;

[0032] The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester.

[0033] Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded;

[0034] Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient in turn based on the upload parameters.

[0035] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0036] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0037] The hook method to be invoked is determined based on the type of the receiver.

[0038] In some embodiments, it also includes:

[0039] Set up multiple hook methods, each corresponding to a different receiver.

[0040] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0041] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0042] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0043] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0044] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0045] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0046] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0047] In some embodiments, it also includes:

[0048] Monitor the upload progress.

[0049] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the following steps:

[0050] Receive the first request sent by the requester, which includes upload parameters;

[0051] The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester.

[0052] Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded;

[0053] Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient in turn based on the upload parameters.

[0054] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0055] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0056] The hook method to be invoked is determined based on the type of the receiver.

[0057] In some embodiments, it also includes:

[0058] Set up multiple hook methods, each corresponding to a different receiver.

[0059] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0060] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0061] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0062] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0063] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0064] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0065] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0066] In some embodiments, it also includes:

[0067] Monitor the upload progress.

[0068] The present invention has one of the following beneficial technical effects: The solution proposed in this invention treats the server as a relay station for file streams, directly forwarding the stream to the receiver, which greatly improves the efficiency of file upload and the usability of the cloud platform; moreover, by not caching the files to be uploaded on the server, it also eliminates the risk of insufficient storage space caused by too many or too large uploaded files, making the business system more robust. Attached Figure Description

[0069] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other embodiments can be obtained based on these drawings without creative effort.

[0070] Figure 1 A schematic flowchart of a file upload method provided for an embodiment of the present invention;

[0071] Figure 2 A flowchart for processing a first request provided for an embodiment of the present invention;

[0072] Figure 3 A flowchart for processing a second request provided for an embodiment of the present invention;

[0073] Figure 4 A schematic diagram of the structure of a file upload system provided for an embodiment of the present invention;

[0074] Figure 5 A schematic diagram of the structure of a computer device provided for an embodiment of the present invention;

[0075] Figure 6 A schematic diagram of the structure of a computer-readable storage medium provided for an embodiment of the present invention. Detailed Implementation

[0076] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.

[0077] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.

[0078] According to one aspect of the present invention, embodiments of the present invention provide a file upload method, such as... Figure 1 As shown, it may include the following steps:

[0079] S1, receive the first request sent by the requester, which includes upload parameters;

[0080] S2, store the upload parameters in the cache and send the identifier corresponding to the upload parameters back to the requester;

[0081] S3, receive a second request from the requester, including the identifier and multiple files to be uploaded;

[0082] S4. Based on the identifier in the second request, obtain the upload parameters in the cache and forward each file to be uploaded to the receiver in turn based on the upload parameters.

[0083] The proposed solution treats the server as a file stream relay station, directly forwarding the stream to the receiver, which greatly improves the efficiency of file upload and enhances the usability of the cloud platform. Moreover, by not caching the files to be uploaded on the server, it also eliminates the risk of insufficient storage space caused by too many or too large uploaded files, making the business system more robust.

[0084] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0085] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0086] The hook method to be invoked is determined based on the type of the receiver.

[0087] Specifically, such as Figure 2 As shown, after receiving the first request, some business layer processing can be performed on the parameters in the first request, including parameter validation, data entry into the database, virtualization platform connection validation, etc.

[0088] In an embodiment of the present invention, the process of reading the file stream is divided into two steps. Simply put, the requester initiates two business requests, and the file stream is also uploaded in two steps. The first step only uploads the parameters. After the backend receives the parameters, it caches them and sets the corresponding identifier, such as a key, and returns it to the requester. Then, the requester carries the identifier in the second request to upload the file stream. In this way, the parameters can be associated with the file to be uploaded. In subsequent steps, the file to be uploaded is forwarded to the corresponding recipient, such as a virtualization platform or a third-party platform, based on the parameters.

[0089] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0090] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0091] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0092] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0093] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0094] Specifically, such as Figure 3 As shown, the second request carries multiple files, which can be separated by delimiters. Each file is obtained through the delimiters. After reading a file, the parameters corresponding to that file, such as the storage location, are retrieved from the cache, and then the hook method is called to upload it to the corresponding receiver.

[0095] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0096] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0097] In some embodiments, it also includes:

[0098] Set up multiple hook methods, each corresponding to a different receiver.

[0099] Specifically, such as Figure 3 As shown, to better accommodate different business processes during the file stream reading process, this invention employs the template method design pattern. The processing and uploading of the file stream is implemented as a file processing module, and the business methods are implemented as hook methods within the module. The business layer only needs to obtain the file stream and file name from the module; other logic can be defined by the business layer itself. Specifically, a pre-defined interface is reserved within this module. Reading the file from the second request and retrieving the corresponding parameters from the cache are both internal logic implementations of this module. Uploading the file to the recipient based on the parameters is achieved by calling the corresponding hook method through this pre-defined interface. Different hook methods correspond to different recipients (different recipients have different upload logic, thus requiring different hook methods). This ensures that even if the recipient changes, the logic for handling file reading and retrieving the corresponding parameters from the cache within the file processing module can be reused. Only the corresponding hook method needs to be designed based on the recipient. Then, when executing the step of uploading the file to the recipient, the hook method is called through the pre-defined interface to achieve file upload based on the hook method.

[0100] In some embodiments, it also includes:

[0101] Monitor the upload progress.

[0102] Specifically, such as Figure 3 As shown, the progress of an upload task can be monitored.

[0103] The proposed solution for uploading files does not rely on caching to store file streams. Instead, it reads the file stream in a loop and forwards it directly. A distributed processing approach is used for upload parameters and files. In the first step, only business parameters are processed and cached. In the second step, only the file stream is processed; the business system retrieves the parameters from the cache and forwards the file stream to the specific virtualization platform. A template design is employed during the upload process, making the entire process a module. Business processing is implemented as hook methods within this module, thus improving business compatibility. This decoupling of file stream reading and processing via the template method pattern ensures better compatibility with business logic.

[0104] Based on the same inventive concept, according to another aspect of the present invention, embodiments of the present invention also provide a file upload system 400, such as... Figure 4 As shown, it includes:

[0105] The first receiving module 401 is configured to receive a first request sent by the requester, including upload parameters;

[0106] Feedback module 402 is configured to store the upload parameters in a cache and feed back the identifier corresponding to the upload parameters to the requester;

[0107] The second receiving module 403 is configured to receive a second request sent by the requester, which includes the identifier and multiple files to be uploaded;

[0108] The forwarding module 404 is configured to obtain the upload parameters in the cache based on the identifier in the second request and forward each file to be uploaded to the receiver in sequence based on the upload parameters.

[0109] In some embodiments, the first receiving module 401 is further configured to:

[0110] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0111] The hook method to be invoked is determined based on the type of the receiver.

[0112] In some embodiments, a setting module is also included, configured as follows:

[0113] Set up multiple hook methods, each corresponding to a different receiver.

[0114] In some embodiments, the forwarding module 404 is further configured to:

[0115] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0116] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0117] In some embodiments, the forwarding module 404 is further configured to:

[0118] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0119] In some embodiments, the forwarding module 404 is further configured to:

[0120] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0121] In some embodiments, a monitoring module is also included, configured as follows:

[0122] Monitor the upload progress.

[0123] The proposed solution for uploading files does not rely on caching to store file streams. Instead, it reads the file stream in a loop and forwards it directly. A distributed processing approach is used for upload parameters and files. In the first step, only business parameters are processed and cached. In the second step, only the file stream is processed; the business system retrieves the parameters from the cache and forwards the file stream to the specific virtualization platform. A template design is employed during the upload process, making the entire process a module. Business processing is implemented as hook methods within this module, thus improving business compatibility. This decoupling of file stream reading and processing via the template method pattern ensures better compatibility with business logic.

[0124] Based on the same inventive concept, according to another aspect of the present invention, such as Figure 5 As shown, embodiments of the present invention also provide a computer device 501, comprising:

[0125] At least one processor 520; and

[0126] Memory 510 stores a computer program 511 that can run on a processor. When the processor 520 executes the program, it performs the following steps:

[0127] Receive the first request sent by the requester, which includes upload parameters;

[0128] The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester.

[0129] Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded;

[0130] Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient in turn based on the upload parameters.

[0131] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0132] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0133] The hook method to be invoked is determined based on the type of the receiver.

[0134] In some embodiments, it also includes:

[0135] Set up multiple hook methods, each corresponding to a different receiver.

[0136] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0137] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0138] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0139] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0140] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0141] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0142] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0143] In some embodiments, it also includes:

[0144] Monitor the upload progress.

[0145] Based on the same inventive concept, according to another aspect of the present invention, such as Figure 6 As shown, embodiments of the present invention also provide a computer-readable storage medium 601, which stores a computer program 610. When the computer program 610 is executed by a processor, it performs the following steps:

[0146] Receive the first request sent by the requester, which includes upload parameters;

[0147] The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester.

[0148] Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded;

[0149] Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient in turn based on the upload parameters.

[0150] In some embodiments, receiving a first request including upload parameters sent by the requester further includes:

[0151] The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request.

[0152] The hook method to be invoked is determined based on the type of the receiver.

[0153] In some embodiments, it also includes:

[0154] Set up multiple hook methods, each corresponding to a different receiver.

[0155] In some embodiments, obtaining upload parameters from the cache based on the identifier in the second request and forwarding each file to be uploaded to the receiver sequentially based on the upload parameters further includes:

[0156] Each file to be uploaded is read sequentially from the second request based on the separator point;

[0157] Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the recipient based on the corresponding storage location.

[0158] In some embodiments, after each file to be uploaded is read, the corresponding storage location is obtained from the cache to forward the file to be uploaded to the recipient based on the corresponding storage location, further including:

[0159] In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

[0160] In some embodiments, in response to reading a file to be uploaded in the second request, a hook method is invoked and the read file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method, further including:

[0161] In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

[0162] In some embodiments, it also includes:

[0163] Monitor the upload progress.

[0164] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods.

[0165] Furthermore, it should be understood that the computer-readable storage medium (e.g., memory) described herein may be volatile memory or non-volatile memory, or may include both volatile memory and non-volatile memory.

[0166] Those skilled in the art will also understand that the various exemplary logic blocks, modules, circuits, and algorithm steps described in conjunction with the disclosure herein can be implemented as electronic hardware, computer software, or a combination of both. To clearly illustrate this interchangeability between hardware and software, the functionality of various illustrative components, blocks, modules, circuits, and steps has been generally described. Whether this functionality is implemented as software or as hardware depends on the specific application and the design constraints imposed on the system as a whole. Those skilled in the art can implement the functionality in various ways for each specific application, but such implementation decisions should not be construed as departing from the scope of the embodiments disclosed herein.

[0167] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.

[0168] It should be understood that, as used herein, the singular form “a” is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, “and / or” refers to any and all possible combinations of one or more of the associated listed items.

[0169] The embodiment numbers disclosed in the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0170] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0171] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.

Claims

1. A file upload method, characterized in that, Includes the following steps: Receive the first request sent by the requester, which includes upload parameters; The upload parameters are stored in the cache, and the identifier corresponding to the upload parameters is fed back to the requester. Receive a second request from the requesting party, which includes the identifier and multiple files to be uploaded; Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the receiver in turn based on the upload parameters; The first request sent by the receiving party, including upload parameters, further includes: The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request. The hook method to be invoked is determined based on the type of the receiver; Based on the identifier in the second request, the upload parameters in the cache are obtained, and each file to be uploaded is forwarded to the recipient sequentially based on the upload parameters. This further includes: Each file to be uploaded is read sequentially from the second request based on the separator point; Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the receiver based on the corresponding storage location; The process of retrieving the corresponding storage location from the cache after each read of a file to be uploaded, and then forwarding the file to be uploaded to the recipient based on the corresponding storage location, further includes: In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

2. The method as described in claim 1, characterized in that, Also includes: Set up multiple hook methods, each corresponding to a different receiver.

3. The method as described in claim 1, characterized in that, In response to reading a file to be uploaded in the second request, a hook method is invoked and, based on the hook method, the read file to be uploaded is forwarded to the corresponding storage location in the receiver, further including: In response to reading a file to be uploaded from the second request, the hook method is invoked through a preset interface.

4. The method as described in claim 1, characterized in that, Also includes: Monitor the upload progress.

5. A file upload system, characterized in that, include: The first receiving module is configured to receive a first request sent by the requester, including upload parameters; The feedback module is configured to store the upload parameters in a cache and send the identifier corresponding to the upload parameters back to the requester. The second receiving module is configured to receive a second request sent by the requester, which includes the identifier and multiple files to be uploaded; The forwarding module is configured to obtain the upload parameters in the cache based on the identifier in the second request and forward each file to be uploaded to the receiver in turn based on the upload parameters; The first receiving module is also configured as follows: The type of the recipient and the storage location of each file to be uploaded are determined based on the upload parameters in the first request. The hook method to be invoked is determined based on the type of the receiver; The forwarding module is also configured as follows: Each file to be uploaded is read sequentially from the second request based on the separator point; Each time a file to be uploaded is read, the corresponding storage location is obtained from the cache, and the file to be uploaded is forwarded to the receiver based on the corresponding storage location; The process of retrieving the corresponding storage location from the cache after each read of a file to be uploaded, and then forwarding the file to be uploaded to the recipient based on the corresponding storage location, further includes: In response to reading a file to be uploaded in the second request, a hook method is invoked and the file to be uploaded is forwarded to the corresponding storage location in the receiver based on the hook method.

6. A computer device, comprising: At least one processor; as well as A memory storing a computer program executable on the processor, characterized in that the processor executes the program by performing the steps of the method as described in any one of claims 1-4.

7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it performs the steps of the method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Method, system and equipment for safely storing and downloading files in distributed system

    CN113014665A