File uploading method and device, equipment, storage medium and program product

Through file hash value verification and task cache queue management, the problem of excessive load on server resources in large file uploads is solved, improving user experience and data integrity.

CN118540320APending Publication Date: 2024-08-23SHANGHAI JIACHE INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410697417.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-31
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

During the uploading process of large files, the existing technology causes excessive load on server resources, causing users to wait for too long, and when the network conditions are not good, it may lead to data loss and poor user experience.

Method used

Verify file uniqueness by generating the first hash value, store tasks in the task cache queue, only perform file upload tasks when hardware resources are idle, and use the second hash value to perform complete file verification to avoid high load on server hardware resources. .

Benefits of technology

It effectively avoids high load on server hardware resources, improves users' experience of uploading files, and ensures data integrity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540320A
    Figure CN118540320A
Patent Text Reader

Abstract

The invention discloses a file uploading method and device, equipment, a storage medium and a program product, and relates to the technical field of computers. The method comprises the following steps: when a file uploading request is received, generating a first hash value for a file, and performing uniqueness verification on the file based on the first hash value; when the file passes the uniqueness verification, storing a file uploading task corresponding to the file in a task cache queue, and returning a task processing state to the client; and when the hardware resource state of the server is an idle state, extracting the file uploading task from the task cache queue, and executing the file uploading task. According to the technical scheme provided by the invention, hardware resources of the server can be prevented from being in a high-load state, and the experience feeling of a user in a file uploading process can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a file uploading method, device, equipment, storage medium and program product. Background Art

[0002] In today's digital world, data integrity and security are of vital importance. Whether in cloud storage services, file sharing platforms or content distribution networks, ensuring that files have not been tampered with during transmission is the key to maintaining data integrity. For large files with large amounts of data, the calculation process of the integrity identification value may take up a lot of server resources, causing users to wait too long. If the network conditions are not good, once a disconnection occurs, data loss may occur, and users can only choose to re-upload the file, which is a very poor user experience. Therefore, it is necessary to design a file upload method that can alleviate the server load and improve the user's experience of uploading files. Summary of the invention

[0003] The present application provides a file uploading method, device, equipment, storage medium and program product, which can avoid the server hardware resources being in a high load state and improve the user experience in the process of uploading files.

[0004] In a first aspect, the present application provides a file upload method, which is applied to a server, and the method comprises:

[0005] When receiving a file upload request, generating a first hash value for the file, and performing uniqueness verification on the file based on the first hash value;

[0006] When the file passes the uniqueness verification, the file upload task corresponding to the file is stored in the task cache queue, and the task processing status is returned to the client;

[0007] When the hardware resource state of the server is an idle state, the file upload task is extracted from the task cache queue and the file upload task is executed.

[0008] Furthermore, executing the file upload task includes: generating a second hash value for the file, the second hash value being used for file integrity verification when transmitting with a downstream server; associating the second hash value, the first hash value and the file to obtain associated data; and uploading the associated data to the server to complete the file upload task of the file.

[0009] Furthermore, the uniqueness of the file is verified based on the first hash value, including: generating a key-value pair based on the file name, the client identification number and the first hash value of the file; determining whether the key-value pair exists in the cache database; if the key-value pair does not exist, determining that the file has passed the uniqueness verification.

[0010] Furthermore, before generating a second hash value for the file, it also includes: determining whether there is a second hash value associated with the first hash value in the verification code association table; if so, storing the key-value pair in the cache database; if not, executing the operation of generating a second hash value for the file.

[0011] Furthermore, the method also includes: when the file fails to pass the uniqueness verification, querying the second hash value associated with the first hash value from the verification code association table; determining whether the second hash value exists in the file path table; if not, determining the upload path of the file, generating a data relationship pair with the upload path and the second hash value, and storing the data relationship pair in the file path table; if it exists, discarding the file.

[0012] Furthermore, the first Hash value is generated by a Blake2 algorithm, and the second Hash value is generated by a one-way hash algorithm.

[0013] In a second aspect, the present application provides a file uploading device, which is integrated in a server, and the device includes:

[0014] A file verification module, configured to generate a first hash value for a file when a file upload request is received, and to verify the uniqueness of the file based on the first hash value;

[0015] The task cache module is used to store the file upload task corresponding to the file in the task cache queue when the file passes the uniqueness verification, and return the task processing status to the client;

[0016] The file upload module is used to extract the file upload task from the task cache queue and execute the file upload task when the hardware resource status of the server is idle.

[0017] In a third aspect, the present application provides an electronic device, 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 can execute the file upload method described in any embodiment of the present application.

[0018] In a fourth aspect, the present application provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a processor to implement the file upload method described in any embodiment of the present application when executed.

[0019] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the file upload method described in any embodiment of the present application.

[0020] In order to solve the defects of the prior art in the background technology, the embodiment of the present application provides a file upload method, and the execution of the method can bring the following beneficial effects: when the server receives the file upload request sent by the client, it first verifies the uniqueness of the file to determine whether the file is uploaded repeatedly by the user, which can avoid wasting the hardware resources of the server; when the hardware resource status of the server is busy, the file upload task corresponding to the file is stored in the task cache queue, and when the hardware resource status is idle, the file upload task is executed. By uploading files asynchronously in time-sharing, the server can avoid the server hardware resources being in a high-load state, which can improve the user's experience in the process of uploading files.

[0021] It should be noted that the above computer instructions may be stored in whole or in part on a computer-readable storage medium, wherein the computer-readable storage medium may be packaged together with the processor of the file upload device, or may be packaged separately from the processor of the file upload device, which is not limited in this application.

[0022] The description of the second, third, ..., and fifth aspects in this application can refer to the detailed description of the first aspect; and the beneficial effects of the description of the second, third, ..., and fifth aspects can refer to the beneficial effect analysis of the first aspect, which will not be repeated here.

[0023] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description.

[0024] It is understandable that before using the technical solutions disclosed in the embodiments of this application, the type, scope of use, and usage scenarios of the personal information involved in this application should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0026] Figure 1 A flowchart of a file uploading method provided in an embodiment of the present application;

[0027] Figure 2 A schematic block diagram of the overall process of the file uploading method provided in the embodiment of the present application;

[0028] Figure 3 A schematic diagram of the structure of a file uploading device provided in an embodiment of the present application;

[0029] Figure 4 It is a block diagram of an electronic device used to implement a file uploading method in an embodiment of the present application. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, 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 this application.

[0031] It should be noted that the terms "first", "second", "target", and "original" 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 the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including", "having", and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product, or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products, or devices.

[0032] Figure 1The present invention provides a flowchart of a method for uploading a file provided in an embodiment of the present application. The present embodiment is applicable to the case where a file with a large amount of data is uploaded to a server. The method for uploading a file provided in the present embodiment can be executed by a file uploading device provided in an embodiment of the present application. The device can be implemented in software and / or hardware and integrated in an electronic device that executes the method.

[0033] See also Figure 1 The method of this embodiment includes but is not limited to the following steps:

[0034] S110. When a file upload request is received, a first hash value is generated for the file, and uniqueness verification of the file is performed based on the first hash value.

[0035] The file upload request may include the file name and the client identification number. The file may be a large file with a data volume that reaches a preset standard. The first hash value is used to verify the uniqueness of the file.

[0036] In an embodiment of the present application, a user initiates a file upload request to a server on a file upload interface of a client or a browser. After receiving the file upload request, the server can generate a first hash value, i.e., a Blake2 value, through the Blake2 algorithm. The first hash value is used to verify whether the user has uploaded the file repeatedly. The advantage of using the Blake2 algorithm is that the calculation speed of the Blake2 algorithm is better than that of the one-way hash algorithm (Message-Digest Algorithm 5, MD5), which will significantly reduce the response waiting time of the user end.

[0037] Further, the uniqueness of the file is verified based on the first hash value, including: parsing the file upload request to obtain the file name and the client identification number of the file; generating a key-value pair based on the file name, the client identification number and the first hash value, such as {<file name>- <userid>: {<Blake2 value>}; Determine whether the key-value pair corresponding to the first hash value exists in the data table (such as the file_blake2 table) used to record in the cache database; if the key-value pair does not exist, it is determined that the file is uploaded by the user for the first time, then it is determined that the file has passed the uniqueness verification; if the key-value pair exists, it is determined that the file is not uploaded by the user for the first time, that is, a repeated upload, then it is determined that the file has not passed the uniqueness verification. Among them, the cache database can be a non-relational database, such as a Redis database.

[0038] Optionally, when the file fails the uniqueness verification, it indicates that the file is a repeated upload. It can be determined that a second hash value has been generated for the file before for file integrity verification when transmitting with the downstream server. The second hash value associated with the first hash value can be queried from the verification code association table based on the first hash value. Obtain the file path table (such as the md5_path table) for storing the file upload path, and determine whether the second hash value exists in the file path table; if it does not exist, determine the upload path of the file, generate a data relationship pair by associating the upload path and the second hash value, and store the data relationship pair in the file path table; if it exists, it indicates that the file has been uploaded and the upload path of the file has also been recorded, then discard the file. Among them, the verification code association table is used to record information related to the uniqueness verification code and integrity verification code of the file.

[0039] S120. When the file passes the uniqueness verification, store the file upload task corresponding to the file into the task cache queue, and return the task processing status to the client.

[0040] Among them, the task cache queue is used to temporarily store some file upload tasks so that the server can asynchronously process these file upload tasks at different times.

[0041] In the embodiment of the present application, when the file passes the uniqueness verification, determine the hardware resource status of the server. When the hardware resource status is in an idle state, the file upload task can be directly executed. When the hardware resource status is in a busy state, store the file upload task corresponding to the file into the task cache queue, generate task processing status information representing the file upload task, and send the task processing status to the client. At this time, the connection with the client or browser can be terminated. The advantage of such a setting is that the server can return the task processing status earlier, which can reduce the response waiting time of the user; the server uploads files asynchronously at different times, which can avoid the server hardware resources being in a high-load state for a long time.

[0042] Optionally, the specific content of the task processing status can be that the file is waiting to be uploaded.

[0043] S130: When the hardware resource status of the server is idle, extract the file upload task from the task cache queue and execute the file upload task.

[0044] In an embodiment of the present application, the hardware resource status of the server is monitored in real time. When the hardware resource status is idle, the server can extract the file upload task from the task cache queue and execute the file upload task.

[0045] Furthermore, executing the file upload task includes: generating a second hash value for the file, such as an MD5 value; establishing a corresponding relationship between the second hash value and the first hash value, and storing them in a verification code association table, such as the Blake2_md5 table, associating the verification code association table with the file to obtain associated data; uploading the associated data to the server to complete the file upload task. Among them, the second hash value is used to perform file integrity verification when transmitting with the downstream server, and the second hash value is generated by the MD5 algorithm. The advantage of setting up a verification code association table is that it can not only ensure the uniqueness of the file, but also reduce the phenomenon of repeated storage of the same file.

[0046] Furthermore, before generating the second hash value for the file, it also includes: determining whether there is a second hash value associated with the first hash value in the verification code association table, that is, determining whether anyone other than the current user has uploaded the file. If so, the first hash value can be obtained directly without recalculating it, which can save the response time of file uploading; if so, it indicates that someone else has uploaded the file, and the key-value pair generated based on the first hash value is stored in the cache database; if not, it indicates that someone else has not uploaded the file, and a second hash value is generated for the file through the MD5 algorithm.

[0047] The technical solution provided by this embodiment generates a first hash value for the file when a file upload request is received, and performs uniqueness verification on the file based on the first hash value; when the file passes the uniqueness verification, the file upload task corresponding to the file is stored in the task cache queue, and the task processing status is returned to the client; when the hardware resource status of the server is idle, the file upload task is extracted from the task cache queue, and the file upload task is executed. In this application, when the server receives a file upload request sent by the client, it first verifies the uniqueness of the file to determine whether the file is a duplicate upload by the user, which can avoid wasting the hardware resources of the server; when the hardware resource status of the server is busy, the file upload task corresponding to the file is stored in the task cache queue, and when the hardware resource status is idle, the file upload task is executed. By uploading files asynchronously in time-sharing, the server hardware resources can be prevented from being in a high-load state, which can improve the user's experience in the process of uploading files.

[0048] Figure 2 The overall process diagram of the file upload method is shown in the figure. The figure shows that the user triggers a file upload request for a large file on the client or browser. The server receives the file upload request, then generates a Blake2 value for the file, and generates a key-value pair based on the file name, client identification number and Blake2 value, such as {<file name>- <userid>:<Blake2 value>}. The following steps can be divided into three cases,

[0049] The first case: The server determines whether there is a key-value pair in the file_blake2 table of the Redis database. If not, it is determined that the user uploads the file for the first time; then it queries the Blake2_md5 table according to the Blake2 value to check if there is an MD5 value corresponding to the Blake2 value. If not, it means that no one else has uploaded the file either, and then the file upload task is stored in the task cache queue, and the task processing status is returned to the client.

[0050] The second case: The server determines whether there is a key-value pair in the file_blake2 table of the Redis database. If so, it is determined that the user uploads the file repeatedly, and it queries the corresponding MD5 value in the Blake2_md5 table based on the Blake2 value, and checks if there is an MD5 value in the md5_path table. If there is, the file is discarded; if not, the upload path of the file is determined, and the upload path and the MD5 value are associated and stored in the md5_path table.

[0051] The third case: Query the Blake2_md5 table according to the Blake2 value to check if there is an MD5 value corresponding to the Blake2 value. If there is, it means that someone else has uploaded the file and there is already a file with the same content on the server. The key-value pair corresponding to the Blake2 value (i.e., {<file name>- <userid>: Store the <Blake2 value> in the file_blake2 table. Then, query the corresponding MD5 value in the database Blake2_md5 table based on the Blake2 value, and determine whether the MD5 value exists in the md5_path table. If it exists, discard the file. If it does not exist, determine the upload path of the file, associate the upload path with the MD5 value, and store them in the md5_path table.

[0052] Figure 3 It is a schematic structural diagram of a file upload device provided by an embodiment of the present application. As Figure 3 shown, the device 300 is applied to the server side and may include:

[0053] A file verification module 310, configured to generate a first hash value for the file when receiving a file upload request, and perform uniqueness verification on the file based on the first hash value;

[0054] A task cache module 320, configured to store the file upload task corresponding to the file in a task cache queue when the file passes the uniqueness verification, and return a task processing status to the client;

[0055] A file upload module 330, configured to extract the file upload task from the task cache queue and execute the file upload task when the hardware resource status of the server side is in an idle state.

[0056] Further, the above file upload module 330 may specifically be configured to: generate a second hash value for the file, where the second hash value is used for file integrity verification when transmitting with a downstream server; associate the second hash value, the first hash value, and the file to obtain associated data; upload the associated data to the server to complete the file upload task of the file.

[0057] Further, the above file verification module 310 may specifically be configured to: generate a key-value pair based on the file name, client identification number, and the first hash value of the file; determine whether the key-value pair exists in the cache database; if the key-value pair does not exist, determine that the file has passed the uniqueness verification.

[0058] Further, the above file upload module 330 may also specifically be configured to: before generating the second hash value for the file, determine whether a second hash value associated with the first hash value exists in the verification code association table; if it exists, store the key-value pair in the cache database; if it does not exist, perform the operation of generating the second hash value for the file.

[0059] Further, the above file upload device may further include: an upload path determination module;

[0060] The upload path determination module is used to query the second hash value associated with the first hash value from the verification code association table when the file fails the uniqueness verification; determine whether the second hash value exists in the file path table; if not, determine the upload path of the file, generate a data relationship pair with the upload path and the second hash value, and store the data relationship pair in the file path table; if exists, discard the file.

[0061] Optionally, the first Hash value is generated by a Blake2 algorithm, and the second Hash value is generated by a one-way hash algorithm.

[0062] The file uploading device provided in this embodiment can be applied to the file uploading method provided in any of the above embodiments, and has corresponding functions and beneficial effects.

[0063] Figure 4 It is a block diagram of an electronic device for implementing a file upload method of an embodiment of the present application. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0064] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0065] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0066] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a file upload method.

[0067] In some embodiments, the file upload method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the file upload method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the file upload method in any other appropriate manner (e.g., by means of firmware).

[0068] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0069] The computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor, the functions / operations specified in the flow charts and / or block diagrams are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0070] In the context of the present application, a computer readable storage medium may be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, device, or equipment. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. Alternatively, a computer readable storage medium may be a machine readable signal medium. A more specific example of a machine readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0071] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).

[0072] The systems and techniques described herein can be implemented in a computing system that includes backend components (e.g., as a data server) or a computing system that includes middleware components (e.g., an application server) or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein) or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0073] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.

[0074] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present application. For example, those skilled in the art can use the various forms of processes shown above to reorder, add, or delete steps; the steps recorded in the present application can be performed in parallel, sequentially, or in different orders, as long as the desired results of the technical solution of the present application can be achieved, and this document does not limit them here.

[0075] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.< / userid> < / userid> < / userid>

Claims

1. A file uploading method, characterized in that: Applied to the server, the method includes: When receiving a file upload request, generating a first hash value for the file, and performing uniqueness verification on the file based on the first hash value; When the file passes the uniqueness verification, the file upload task corresponding to the file is stored in the task cache queue, and the task processing status is returned to the client; When the hardware resource state of the server is an idle state, the file upload task is extracted from the task cache queue and the file upload task is executed.

2. The file uploading method according to claim 1, characterized in that: Executing the file upload task includes: Generating a second Hash value for the file, wherein the second Hash value is used for file integrity verification when transmitting to a downstream server; Associating the second Hash value, the first Hash value, and the file to obtain associated data; The associated data is uploaded to the server to complete the file upload task of the file.

3. The file uploading method according to claim 2, characterized in that: Performing uniqueness verification on the file based on the first hash value includes: Generate a key-value pair based on the file name, the client identification number and the first Hash value of the file; Determine whether the key-value pair exists in the cache database; If the key-value pair does not exist, it is determined that the file has passed the uniqueness verification.

4. The file uploading method according to claim 3, characterized in that: Before generating a second hash value for the file, the method further includes: Determine whether there is a second hash value associated with the first hash value in the verification code association table; If it exists, the key-value pair is stored in the cache database; If not present, an operation of generating a second hash value for the file is performed.

5. The file uploading method according to claim 1, characterized in that: The method further comprises: When the file fails the uniqueness verification, querying a second hash value associated with the first hash value from a verification code association table; Determine whether the second hash value exists in the file path table; If it does not exist, determining the upload path of the file, generating a data relationship pair with the upload path and the second hash value, and storing the data relationship pair in the file path table; If it exists, the file is discarded.

6. The file uploading method according to claim 2, characterized in that: The first Hash value is generated by a Blake2 algorithm, and the second Hash value is generated by a one-way hash algorithm.

7. A file uploading device, characterized in that: Integrated in the server, the device includes: A file verification module, configured to generate a first hash value for a file when a file upload request is received, and to verify the uniqueness of the file based on the first hash value; The task cache module is used to store the file upload task corresponding to the file in the task cache queue when the file passes the uniqueness verification, and return the task processing status to the client; The file upload module is used to extract the file upload task from the task cache queue and execute the file upload task when the hardware resource status of the server is idle.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores a computer program executed 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 can execute the file upload method according to any one of claims 1 to 6.

9. 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 processor to implement the file uploading method according to any one of claims 1 to 6 when executed.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the file upload method according to any one of claims 1 to 6.