File uploading method and related device
By slicing and concurrent uploading of power system files and continuing to transfer breakpoints, the problems of traditional large file uploading methods that take up a long time in the network and data loss in the power system are solved, efficient and reliable file transmission is achieved, and the normal operation of the power system is ensured.
Patent Information
- Application Number
- CN202510721189.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-30
- Publication Date
- 2025-07-22
AI Technical Summary
The traditional large file upload method in the power system is difficult to meet the actual needs of the power system due to the large data scale and complex application, resulting in long-term network occupation, large resource occupation, data loss during network interruption, and file corruption.
Slice and encrypt the files to be uploaded, and use multi-concurrent upload strategies and breakpoint relay technology to monitor the upload progress and perform breakpoint relay in case of failure to ensure file integrity and reliability.
It improves file upload efficiency and stability, reduces network congestion, ensures that the decision-making and operation and maintenance of the power system are not affected, enhances the availability and reliability of files, and reduces the risk of file corruption or loss caused by network problems or equipment failures.
Smart Images

Figure CN120358231A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of power system data transmission and storage, and particularly relates to a file uploading method and related devices. Background Art
[0002] In the field of power systems, with the continuous advancement of the construction of smart grids, the increasing intelligence of power equipment, and the accelerating digital transformation of the power industry, the scale of data files related to power system operation, monitoring, management, and analysis is expanding rapidly at an unprecedented rate; in a broader scope of online applications and services, large file uploading has become a common and key requirement in the field of power systems, running through all aspects of the power system.
[0003] Although large file uploading plays an important role in the field of power systems, traditional large file uploading methods expose many insurmountable limitations when faced with the increasing data scale and complex application scenarios in power systems, and it has become difficult to meet the actual needs. For example: traditional large file uploading methods usually adopt the mode of uploading the entire file at one time. For large monitoring data files, high-precision graphic and image materials, and audio and video files in power systems, the file size is often large, and the uploading process will occupy a large amount of network bandwidth and system resources for a long time, resulting in network congestion, affecting the normal operation of other services, and even possibly leading to a decline in the performance of the entire system; secondly, when the network is interrupted in the traditional uploading method, the entire uploading process will be interrupted, and the part of the data that has been uploaded will also be lost. Users have to start uploading again, which not only wastes time and traffic, but also may lead to the delayed uploading of key data, affecting the decision-making and operation and maintenance of the power system; in addition, during the uploading process, the file may be damaged or lost due to network problems, equipment failures, etc., resulting in the receiving party being unable to use the file normally. Summary of the Invention
[0004] Aiming at the technical problems existing in the prior art, the present invention provides a file uploading method and related devices to solve the technical problem that traditional file uploading methods often have difficulty meeting the requirements of large file transmission.
[0005] To achieve the above object, the technical solution adopted by the present invention is as follows: The present invention provides a file uploading method, including: Slicing the file to be uploaded to obtain a plurality of file slices; wherein, the file to be uploaded includes data files related to power system operation, monitoring, management, and analysis; Encrypting the plurality of file slices to obtain a plurality of encrypted slices; Storing the plurality of encrypted slices into a preset task queue, and using a multi-concurrency uploading strategy to upload the plurality of encrypted slices in the preset task queue to the server side; Monitor the progress of uploading several encrypted slices in the preset task queue to the server side; if the upload is successful, trigger the server side to merge the several encrypted slices; if the upload fails, based on the breakpoint resumption technology, upload the un-uploaded encrypted slices in the preset task queue to the server side.
[0006] Further, the process of slicing the file to be uploaded to obtain several file slices is as follows: Perform binary splitting on the upload file according to the preset slice size to obtain several file slices.
[0007] Further, the process of encrypting several file slices to obtain several encrypted slices is as follows: Calculate the MD5 hash value of each file slice; Generate a file name with an MD5 identifier based on the MD5 hash value of each file slice; Use the file name with an MD5 identifier to name each file slice to obtain a file slice with an MD5 identifier as the encrypted slice.
[0008] Further, if the upload fails, the process of uploading the un-uploaded encrypted slices in the preset task queue to the server side based on the breakpoint resumption technology is as follows: Compare the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to obtain a list of un-uploaded encrypted slices; among them, the list of un-uploaded encrypted slices records the file names of the un-uploaded encrypted slices; According to the list of un-uploaded encrypted slices, continue to upload the un-uploaded encrypted slices in the preset task queue from the breakpoint to the server side.
[0009] Further, if the upload is successful, after triggering the server side to merge several encrypted slices, it also includes: Based on the number of encrypted slices received by the server side, verify the integrity of the complete file to determine whether there are encrypted slices with upload failures; If there are, compare the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to determine a list of encrypted slices with upload failures; among them, the list of encrypted slices with upload failures records the file names of the encrypted slices with upload failures; According to the list of encrypted slices with upload failures, re-upload the encrypted slices with upload failures in the preset task queue from the breakpoint to the server side.
[0010] Further, the file to be uploaded is a video, audio, document set or picture.
[0011] The present invention also provides a file upload system, including: A file slicing module, configured to slice the file to be uploaded to obtain a plurality of file slices; wherein, the file to be uploaded includes data files related to the operation, monitoring, management and analysis of the power system; A file encryption module, configured to encrypt the plurality of file slices to obtain a plurality of encrypted slices; A file upload module, configured to store the plurality of encrypted slices into a preset task queue, and use a multi-concurrency upload strategy to upload the plurality of encrypted slices in the preset task queue to the server side; A listening and processing module, configured to monitor the progress of uploading the plurality of encrypted slices in the preset task queue to the server side; if the upload is successful, trigger the server side to perform a merging operation on the plurality of encrypted slices; if the upload fails, based on the breakpoint resumption technology, upload the un-uploaded encrypted slices in the preset task queue to the server side.
[0012] The present invention also provides an electronic device, including: A processor, adapted to execute a computer program; A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the file upload method described above is executed.
[0013] The present invention also provides a computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the file upload method described above is implemented.
[0014] The present invention also provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the file upload method described above is implemented.
[0015] Compared with the prior art, the beneficial effects of the present invention are: The file upload method provided by the present invention effectively solves many problems faced by traditional large file upload methods in the power system field through slice upload, multi-concurrent upload, breakpoint resume, encryption protection, and merging operations, improving upload efficiency, reliability, and stability, enhancing file integrity and availability, and providing strong support for decision-making and operation and maintenance of the power system. Specifically, by slicing the file to be uploaded and decomposing the large file into multiple small file slices for upload, it avoids the problem of long-term occupation of a large amount of network bandwidth and system resources caused by traditional one-time upload of the entire large file, thus effectively reducing network congestion, reducing the impact on system performance, and improving upload efficiency. Using the multi-concurrent upload strategy, multiple file slices can be uploaded simultaneously, further accelerating the upload speed and shortening the upload time. When a network interruption or other failures occur during the upload process, based on the breakpoint resume technology, only the unuploaded encrypted slices are uploaded, which not only saves time and traffic but also avoids the delay in uploading critical data caused by re-uploading, thus ensuring that the decision-making and operation and maintenance of the power system are not affected. By listening to the upload progress of the encrypted slices in the preset task queue, the upload status can be understood in real time, problems occurring during the upload process can be discovered and processed in a timely manner, and the availability and reliability of the file are further improved.
[0016] Furthermore, by calculating the MD5 hash value of each file slice and naming the file slice based on the MD5 hash value of each file slice, it is possible to quickly determine whether the file slice has been uploaded to the server side through the MD5 hash value in the file, avoid duplicate uploads, and achieve the ability of instant upload. At the same time, based on the MD5 hash value of each file slice, it is possible to quickly determine the unuploaded or uploaded-failed file slices to accurately and quickly perform the breakpoint resume operation.
[0017] The file upload system, electronic device, computer-readable storage medium, and computer program product provided by the present invention possess all the advantages of the above file upload method. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a flowchart of the file upload method provided for Embodiment 1; Figure 2 It is a structural block diagram of the file upload system provided for Embodiment 2; Figure 3Block diagram of the electronic device provided for Embodiment 3. Detailed implementation manners
[0020] In order to make the technical problems, technical solutions and beneficial effects solved by the present application clearer and more understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application; obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0021] The present invention provides a file uploading method, including the following steps: Step 100: Slice the file to be uploaded to obtain a number of file slices; wherein, the file to be uploaded includes data files related to the operation, monitoring, management and analysis of the power system.
[0022] Step 200: Encrypt the number of file slices to obtain a number of encrypted slices; Step 300: Store the number of encrypted slices into a preset task queue, and use a multi-concurrency uploading strategy to upload the number of encrypted slices in the preset task queue to the server side; Step 400: Monitor the progress of uploading the number of encrypted slices in the preset task queue to the server side; if the upload is successful, trigger the server side to perform a merging operation on the number of encrypted slices; if the upload fails, based on the breakpoint resuming technology, upload the un-uploaded encrypted slices in the preset task queue to the server side.
[0023] The file uploading method provided by the present invention splits a large file into a number of file slices through slicing processing, avoiding occupying a large amount of network bandwidth and system resources for one-time uploading, reducing network congestion and the impact on other services, and ensuring system performance; encrypting the slices and then uploading them using a multi-concurrency uploading strategy to improve the uploading efficiency; at the same time, monitoring the uploading progress, and when the upload fails, using the breakpoint resuming technology to upload the un-uploaded slices, avoiding data loss and duplicate uploading, saving time and traffic, and ensuring that key data is uploaded in a timely manner; in addition, it can significantly reduce the risk of file damage or loss caused by network problems, device failures, etc., ensure that the receiving party can use the file normally, effectively overcome the limitations of the traditional large file uploading method in the power system field, and meet the actual needs.
[0024] The following uses some specific embodiments to further explain the file uploading method provided by the present invention: Embodiment 1 As shown in the appendix Figure 1 This Embodiment 1 provides a file uploading method, including the following steps: Step 1: Slice the file to be uploaded to obtain a number of file slices. Among them, the file to be uploaded includes data files related to the operation, monitoring, management, and analysis of the power system. Preferably, the file to be uploaded is a video, audio, document set, or picture. For example, device monitoring data of the power system, device status information, analysis reports on the operating status of the power system, and graphic, image, or audio-visual materials in the planning, design, and operation and maintenance links of the power system. Among them, the analysis report on the operating status of the power system includes power load forecasting, power grid stability analysis, and equipment fault diagnosis reports. The graphic, image, or audio-visual materials in the planning, design, and operation and maintenance links of the power system, such as the power grid topology structure diagram, geographical information map, 3D model of power equipment, and infrared thermal imaging images stored in the power grid geographic information system.
[0025] Specifically, the process of slicing the file to be uploaded includes: Use the File.prototype.slice method of JavaScript to perform binary splitting on the file to be uploaded according to a preset slice size to obtain a number of file slices. Among them, when performing binary splitting on the file to be uploaded, according to the preset slice size, starting from the starting position of the file to be uploaded, sequentially intercept file segments until the end of the file to be uploaded to obtain a number of file slices. Among them, each file slice retains the original order information, such as the slice serial number, for subsequent file merging. At the same time, generate a unique metadata as a temporary file name for each file slice, including the original file name, slice serial number, and total number of slices, for subsequent processing tracking.
[0026] Step 2: Encrypt the number of file slices to obtain a number of encrypted slices. Specifically, use the spark-md5.js library to calculate the MD5 hash value of each file slice; based on the MD5 hash value of each file slice, generate a file name with an MD5 identifier; use the file name with an MD5 identifier to name each file slice to obtain a file slice with an MD5 identifier as the encrypted slice.
[0027] The process of using the spark-md5.js library to calculate the MD5 hash value of each file slice includes: introducing the spark-md5.js library in the JavaScript environment and creating a SparkMD5 instance. Preferably, the SparkMD5 instance is SparkMD5.hashHex(); read the content of each file slice one by one and input the read slice content into SparkMD5.hashHex() to calculate the MD5 hash value of each file slice.
[0028] The process of generating a file name with an MD5 identifier based on the MD5 hash value of each file slice includes: embedding the MD5 hash value of each file slice into the temporary file name of each file slice, resulting in a file name with an MD5 identifier; where the format of the file name with an MD5 identifier is, for example: original file name_slice number_MD5 hash value.extension. It should be noted that when the MD5 hash value is too long, a preset number of digits of the MD5 hash value is intercepted as the identifier.
[0029] The process of naming each file slice with a file name with an MD5 identifier to obtain a file slice with an MD5 identifier includes: replacing the temporary file name of each file slice with the file name with an MD5 identifier, and thus obtaining a file slice with an MD5 identifier.
[0030] Step 3: Store a number of encrypted slices in a preset task queue, and use a multi-concurrent upload strategy to upload the number of encrypted slices in the preset task queue to the server side.
[0031] Specifically, the steps are as follows: Step 31: Establish a preset task queue; where the preset task queue is used to store a number of encrypted slices to be uploaded; where the data structure of the preset task queue is an array or a linked list.
[0032] Step 32: Set the maximum concurrent upload number according to the network situation and server performance to avoid server rejection or network congestion caused by excessive concurrency.
[0033] Step 33: Use an asynchronous management tool to coordinate concurrent tasks to upload a number of encrypted slices in the preset task queue to the server side; where the asynchronous management tool is, for example, Promise.all or async / await; according to the successful response feedback by the upload interface, record the number of uploaded encrypted slices and the list of failed encrypted slices.
[0034] Step 4: Monitor the progress of uploading a number of encrypted slices in the preset task queue to the server side; if the upload is successful, trigger the server side to perform a merge operation on the number of encrypted slices; if the upload fails, based on the breakpoint resumption technology, upload the un-uploaded encrypted slices in the preset task queue to the server side.
[0035] The process of monitoring the progress of uploading several encrypted slices in the preset task queue to the server side includes: using the upload event of the HTTP request (XMLHttpRequest) or the streaming upload feature of the fetch API to monitor the data transfer progress of the encrypted slices, or pushing the progress update to the front end actively by the server side after receiving the encrypted slices through a WebSocket connection; or calculating the overall upload progress of the encrypted slices through the number of uploaded chunks and the total number of slices.
[0036] It should be noted that the process of pushing the progress update to the front end actively by the server side after receiving the encrypted slices through a WebSocket connection is specifically as follows: when receiving the slice data, the server side needs to push the progress message to the front end through the WebSocket; and the front end updates the progress status of the corresponding encrypted slice by listening to the WebSocket message.
[0037] The process of the server side merging several encrypted slices is specifically as follows: using a stream (Stream) to merge the encrypted slices on the server side; among them, the implementation process of the stream (Stream) includes: (1) Creation of the stream (Stream), selecting a suitable stream creation method according to the data source characteristics to ensure efficient processing of large-scale slice data: the stream creation methods include creation through a collection, creation through an array, creation through values, or obtaining from a file; among them, creation through a collection means using the list.stream() method to obtain an instance of the stream; creation through an array means using the Arrays.stream(array) method; creation through values means using the Stream.of(value1, value2,...) method; obtaining from a file means using the Files.lines(Path, Charset) method.
[0038] (2) Design of the intermediate operation chain, including filtering operations, mapping operations, sorting operations, and splitting and matching operations; among them, the filtering operation is used to filter elements, such as filter(); the mapping operation is used to transform elements, such as map(); the sorting operation is used to sort elements, such as sorted(); the splitting and matching operation is used to split the elements in the stream, such as partition().
[0039] (3) Terminal operations, which are used to trigger the execution of the intermediate operation chain and return results, and complete the conversion from metadata to the actual file merging; the terminal operations include iterative operations, collection operations, reduction operations, lookup operations, maximum / minimum value operations, and conversion operations; among them, iterative operations, such as forEach(), are used to traverse each element in the stream; collection operations, such as collect(), are used to collect the elements in the stream into a collection; reduction operations, such as reduce(), are used to perform reduction calculations on the elements in the stream; lookup operations, such as findFirst(), are used to find the first element in the stream; maximum / minimum value operations, such as max() or min(), are used to find the maximum or minimum value in the stream; conversion operations, such as toArray() or collect(Collectors.toList()), are used to convert the stream into an array or a collection.
[0040] Based on the breakpoint resumption technology, the process of uploading the unuploaded encrypted slices in the preset task queue to the server side includes: comparing the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to obtain a list of unuploaded encrypted slices; among them, the list of unuploaded encrypted slices records the file names of the unuploaded encrypted slices; according to the list of unuploaded encrypted slices, continue to upload the unuploaded encrypted slices in the preset task queue from the breakpoint to the server side.
[0041] Step 5: Check the integrity of the complete file according to the number of uploaded encrypted files.
[0042] Specifically, based on the number of encrypted slices received by the server side, check the integrity of the complete file to determine whether there are encrypted slices that failed to be uploaded; if there are, compare the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to determine the list of encrypted slices that failed to be uploaded; among them, the list of encrypted slices that failed to be uploaded records the file names of the encrypted slices that failed to be uploaded; according to the list of encrypted slices that failed to be uploaded, restart uploading the encrypted slices that failed to be uploaded in the preset task queue from the breakpoint to the server side; if not, the process ends, and mark the upload operation of the file to be uploaded as completed.
[0043] The file upload method described in Embodiment 1 realizes an efficient, reliable and flexible large file upload mechanism through file slicing, encryption, multi-concurrent upload, progress monitoring, breakpoint resumption and integrity verification, and is especially suitable for scenarios such as power systems that have high requirements for data integrity and transmission efficiency. Among them, the amount of data transmitted each time is reduced through slicing processing, and encryption technology is combined to ensure data security. The network resource utilization rate is optimized by using the multi-concurrent upload strategy to improve the transmission speed. Through the progress monitoring and breakpoint resumption functions, the user experience is enhanced and the transmission reliability is ensured. Finally, through the integrity verification mechanism, the accuracy and integrity of the uploaded file are strictly guaranteed, providing solid technical support for data transmission in key fields such as power systems.
[0044] Embodiment 2 As shown in the Figure 2 accompanying figure, Embodiment 2 provides a file upload system, including a file slicing module, a file encryption module, a file upload module and a monitoring and processing module.
[0045] The file slicing module is used to slice the file to be uploaded to obtain a number of file slices. Among them, the file to be uploaded includes data files related to the operation, monitoring, management and analysis of the power system. The file encryption module is used to encrypt a number of file slices to obtain a number of encrypted slices. The file upload module is used to store a number of encrypted slices in a preset task queue and use the multi-concurrent upload strategy to upload a number of encrypted slices in the preset task queue to the server side. The monitoring and processing module is used to monitor the progress of uploading a number of encrypted slices in the preset task queue to the server side. If the upload is successful, it triggers the server side to merge a number of encrypted slices. If the upload fails, based on the breakpoint resumption technology, the un-uploaded encrypted slices in the preset task queue are uploaded to the server side.
[0046] Optionally, the upload file system further includes an integrity verification module. The integrity verification module is used to verify the integrity of the complete file according to the number of encrypted files that have been uploaded.
[0047] Embodiment 3 As shown in the Figure 3As shown, Embodiment 3 of the present invention provides an electronic device, including: a memory for storing a computer program; a processor for implementing the steps of the file upload method when executing the computer program, for example: slicing the file to be uploaded to obtain a plurality of file slices; wherein, the file to be uploaded includes data files related to the operation, monitoring, management, and analysis of the power system; encrypting the plurality of file slices to obtain a plurality of encrypted slices; storing the plurality of encrypted slices in a preset task queue, and using a multi-concurrency upload strategy to upload the plurality of encrypted slices in the preset task queue to the server side; listening to the progress of uploading the plurality of encrypted slices in the preset task queue to the server side; if the upload is successful, triggering the server side to merge the plurality of encrypted slices; if the upload fails, based on the breakpoint resume technology, uploading the un-uploaded encrypted slices in the preset task queue to the server side; and verifying the integrity of the complete file according to the number of uploaded encrypted files.
[0048] Alternatively, when the processor executes the computer program, it implements the functions of each module in the above file upload system, for example: a file slicing module for slicing the file to be uploaded to obtain a plurality of file slices; wherein, the file to be uploaded includes data files related to the operation, monitoring, management, and analysis of the power system; a file encryption module for encrypting the plurality of file slices to obtain a plurality of encrypted slices; a file upload module for storing the plurality of encrypted slices in a preset task queue and using a multi-concurrency upload strategy to upload the plurality of encrypted slices in the preset task queue to the server side; a listening and processing module for listening to the progress of uploading the plurality of encrypted slices in the preset task queue to the server side; if the upload is successful, triggering the server side to merge the plurality of encrypted slices; if the upload fails, based on the breakpoint resume technology, uploading the un-uploaded encrypted slices in the preset task queue to the server side; and an integrity verification module for verifying the integrity of the complete file according to the number of uploaded encrypted files.
[0049] Exemplarily, the computer program may be divided into one or more modules / units, and the one or more modules / units are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing preset functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device.
[0050] The electronic device may be a computing device such as a desktop computer, notebook, handheld computer, and cloud server. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the above are examples of electronic devices and do not constitute a limitation on the electronic device. It may include more components than the above, or combine certain components, or different components. For example, the electronic device may also include a communication interface, input / output devices, network access devices, a bus, etc.
[0051] The so-called processor may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may also be any conventional processor, etc. The processor is the control center of the electronic device, and connects various parts of the entire electronic device through various interfaces and circuits.
[0052] The memory can be used to store the computer program and / or module. The processor realizes various functions of the electronic device by running or executing the computer program and / or module stored in the memory, and by calling the data stored in the memory.
[0053] The memory mainly includes a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.); the data storage area can store data created according to the use of the mobile phone (such as audio data, phone book, etc.). In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, at least one magnetic disk storage device, flash device, or other volatile solid-state storage devices.
[0054] Embodiment 4 Embodiment 4 of the present invention also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the file upload method described above are implemented.
[0055] If the modules / units integrated in the file upload system are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
[0056] Based on such an understanding, to implement all or part of the processes in the above file upload method, the present invention can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above file upload method can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or preset intermediate form, etc.
[0057] The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0058] Embodiment 5 Embodiment 5 of the present invention provides a computer product. The computer program product includes a computer program, and the computer program is stored in a computer-readable storage medium; the processor of the electronic device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the electronic device can execute the file upload method described in Embodiment 1, which will not be elaborated here.
[0059] It should be noted that those of ordinary skill in the art can understand that to implement all or part of the processes in the above embodiment methods, it can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the above method embodiments.
[0060] For the file upload method of the present invention, by splitting the file to be uploaded into multiple file slices and uploading them one by one; after the server receives all the file slices, it combines them into the original file, which can reduce the amount of data uploaded at one time and improve the upload efficiency; at the same time, it supports the function of resuming interrupted downloads; when the network is interrupted or the upload fails, it can continue to upload from the place where the interruption occurred instead of starting over, improving the upload stability and user experience; placing the sharded upload requests in the upload task queue can improve concurrency and reduce coupling; by listening to the progress of encrypted slice uploads in the preset task queue, problems occurring during the upload process can be discovered and processed in a timely manner, further improving the availability and reliability of the file.
[0061] The above embodiments are merely one of the implementation manners capable of implementing the technical solution of the present invention. The scope of protection required by the present invention is not only limited by this embodiment, but also includes any changes, substitutions and other implementation manners that are easily conceivable by those skilled in the art within the technical scope disclosed by the present invention.
Claims
1. A file uploading method, characterized in that, It includes: Slice the file to be uploaded to obtain a number of file slices; among them, the file to be uploaded includes data files related to the operation, monitoring, management, and analysis of the power system; Encrypt the number of file slices to obtain a number of encrypted slices; Store the number of encrypted slices in a preset task queue, and use a multi-concurrent upload strategy to upload the number of encrypted slices in the preset task queue to the server side; Monitor the progress of uploading the number of encrypted slices in the preset task queue to the server side; if the upload is successful, trigger the server side to perform a merge operation on the number of encrypted slices; if the upload fails, based on the breakpoint resumption technology, upload the un-uploaded encrypted slices in the preset task queue to the server side.
2. The file uploading method according to claim 1, wherein, The process of slicing the file to be uploaded to obtain a number of file slices is as follows: Perform binary segmentation on the uploaded file according to the preset slice size to obtain a number of file slices.
3. The file upload method according to claim 1, wherein The process of encrypting the number of file slices to obtain a number of encrypted slices is as follows: Calculate the MD5 hash value of each file slice; Generate a file name with an MD5 identifier based on the MD5 hash value of each file slice; Use the file name with an MD5 identifier to name each file slice to obtain a file slice with an MD5 identifier as the encrypted slice.
4. A file uploading method according to claim 3, characterized in that, If the upload fails, the process of uploading the un-uploaded encrypted slices in the preset task queue to the server side based on the breakpoint resumption technology is as follows: Compare the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to obtain a list of un-uploaded encrypted slices; among them, the list of un-uploaded encrypted slices records the file names of the un-uploaded encrypted slices; According to the list of un-uploaded encrypted slices, continue to upload the un-uploaded encrypted slices in the preset task queue from the breakpoint to the server side.
5. A file upload method according to claim 1, wherein After triggering the server side to perform a merge operation on the number of encrypted slices if the upload is successful, it further includes: Based on the number of encrypted slices received by the server side, verify the integrity of the complete file to determine whether there are encrypted slices with upload failures; If so, compare the file names of the encrypted slices received by the server side with the file names of the encrypted slices in the preset task queue to determine a list of encrypted slices with upload failures; among them, the list of encrypted slices with upload failures records the file names of the encrypted slices with upload failures; According to the list of encrypted slices with upload failures, re-upload the encrypted slices with upload failures in the preset task queue from the breakpoint to the server side.
6. The method for uploading a file according to claim 1, characterized in that The file to be uploaded is a video, audio, document set, or picture.
7. A file upload system, characterized in that, It includes: A file slicing module for slicing the file to be uploaded to obtain a number of file slices; among them, the file to be uploaded includes data files related to the operation, monitoring, management, and analysis of the power system; A file encryption module for encrypting the number of file slices to obtain a number of encrypted slices; A file upload module for storing the number of encrypted slices in a preset task queue and using a multi-concurrent upload strategy to upload the number of encrypted slices in the preset task queue to the server side; A monitoring and processing module is used to monitor the progress of uploading several encrypted slices in a preset task queue to the server side; if the upload is successful, it triggers the server side to perform a merging operation on the several encrypted slices; if the upload fails, based on the breakpoint resumption technology, the un-uploaded encrypted slices in the preset task queue are uploaded to the server side.
8. An electronic device, characterized in that, It includes: A processor suitable for executing a computer program; A computer-readable storage medium, in which a computer program is stored. When the computer program is executed by the processor, it executes the file upload method according to any one of claims 1-6.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the file upload method according to any one of claims 1-6.
10. A computer program product, characterized in that, The computer program product includes a computer program, and when the computer program is executed by the processor, it implements the file upload method according to any one of claims 1-6.