File upload methods, devices, equipment, and storage media

By performing security verification and attribute analysis on the files to be uploaded, and by adopting appropriate file upload methods and security detection measures, the problems of low file upload efficiency and insufficient security have been solved, thus achieving efficient and secure file upload.

CN116506426BActive Publication Date: 2026-04-21SUGON INFORMATION IND
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SUGON INFORMATION IND
Filing Date
2023-05-30
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing file upload methods are inefficient and insecure, resulting in excessive server memory load and failing to consider the security of the file upload process.

Method used

By performing file security verification on the files to be uploaded, determining the upload method of the target file based on the file attribute information, and using third-party storage or database storage for file upload, combined with file fragmentation, compression, and text content security detection, security and efficiency are improved.

Benefits of technology

It improves the security and efficiency of file uploads, reduces server memory usage, and ensures the security and efficiency of the file upload process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116506426B_ABST
    Figure CN116506426B_ABST
Patent Text Reader

Abstract

This invention discloses a file upload method, apparatus, device, and storage medium. The method includes: acquiring a file to be uploaded; performing a file security verification on the file to be uploaded to obtain a security verification result; if the security verification result is successful, determining a target file upload method based on the file attribute information of the file to be uploaded; and uploading the file to be uploaded using the target file upload method. The technical solution of this invention improves file upload efficiency and the security of the file upload process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data processing technology, and in particular to a file upload method, apparatus, device, and storage medium. Background Technology

[0002] File upload functionality is used in a large number of web (World Wide Web) front-end service applications and is one of the common functions of web service applications.

[0003] Existing file upload functionality is rather simplistic, employing a single upload method for all file types, resulting in low upload efficiency and excessive server memory load. Furthermore, during the upload process, security vulnerabilities may arise due to server configuration issues, network problems, or other external factors. However, current file upload methods do not consider security during the upload process itself, leading to inherent security vulnerabilities. Summary of the Invention

[0004] This invention provides a file upload method, apparatus, device, and storage medium to improve file upload efficiency and security.

[0005] According to one aspect of the present invention, a file upload method is provided, the method comprising:

[0006] Get the file to be uploaded;

[0007] Perform a file security check on the file to be uploaded and obtain the security check result;

[0008] If the security verification result is successful, the target file upload method is determined based on the file attribute information of the file to be uploaded.

[0009] The file to be uploaded is uploaded using the target file upload method described above.

[0010] Optionally, the step of performing file security verification on the file to be uploaded and obtaining the security verification result includes:

[0011] Based on the file type of the file to be uploaded, determine the security detection file corresponding to the file type;

[0012] The security detection file is used to perform a first file security verification on the file to be uploaded, and a first security verification result is obtained; and,

[0013] Obtain the file information of the file to be uploaded; the file information includes the file size, a text field, and the field value corresponding to the text field.

[0014] Based on the file size, the text field, and the field value, a second file security check is performed on the file to be uploaded to obtain a second security check result.

[0015] Generate a security verification result that includes the first security verification result and the second security verification result.

[0016] The above technical solution improves the accuracy of determining the security verification result of the uploaded file by comprehensively considering the file type characteristics and file information characteristics of the uploaded file during the security detection process; and improves the comprehensiveness of the security verification of the uploaded file by comprehensively considering the security of the uploaded file from multiple perspectives.

[0017] Optionally, if the target file upload method is the third-party storage file upload method, then the step of uploading the file to be uploaded using the target file upload method includes:

[0018] The file to be uploaded is sent to a third-party storage platform so that the third-party storage platform can store the file to be uploaded and generate and return storage address information;

[0019] After detecting the storage address information, the storage address information is stored to complete the file upload of the file to be uploaded.

[0020] The above technical solution sends the file to be uploaded to a third-party storage platform for storage. After receiving the storage address information from the third-party storage platform, the solution stores the storage address information to complete the file upload. This method effectively uploads files using third-party storage. By storing only the storage address information from the third-party storage platform, the solution reduces server-side memory usage, alleviates memory pressure, and improves file upload efficiency.

[0021] Optionally, if the target file upload method is the database storage file upload method, then the step of uploading the file to be uploaded using the target file upload method includes:

[0022] The file to be uploaded is compressed to obtain a compressed file to be uploaded;

[0023] Perform text content security detection on the compressed file to be uploaded, and obtain the text content security detection result;

[0024] If the text content security detection result is passed, the file to be uploaded is stored to complete the file upload.

[0025] The above technical solution compresses the file to be uploaded to obtain a compressed file, performs text content security checks on the compressed file, and obtains the text content security check result. If the text content security check result is successful, the file to be uploaded is stored, thus completing the file upload. This realizes how to upload files using database storage. By compressing the uploaded file, the storage pressure on the server-side database is reduced, thereby improving storage efficiency; by performing text content security checks on the compressed file, the security of the file to be uploaded is further improved.

[0026] Optionally, before compressing the file to be uploaded to obtain a compressed file to be uploaded, the method further includes:

[0027] Determine the system type of the server system from which the file to be uploaded is uploaded;

[0028] Based on the file size of the file to be uploaded and the system type, determine whether to perform file fragmentation on the file to be uploaded;

[0029] If so, determine the file fragmentation method based on the file type of the file to be uploaded;

[0030] The file to be uploaded is split into at least one file to be uploaded using the file splitting method described above.

[0031] Generate a file to be uploaded that includes at least one file segment to be uploaded.

[0032] The above technical solution determines the system type of the server system uploading the file to be uploaded, and then determines whether to perform file fragmentation based on the file size and system type. If so, the file fragmentation method corresponding to the file type is used to perform file fragmentation, thus achieving file fragmentation for large files and improving file upload speed and efficiency.

[0033] Optionally, the step of compressing the file to be uploaded to obtain a compressed file to be uploaded includes:

[0034] Determine the target file compression method based on the file type of the file to be uploaded;

[0035] Based on the target file compression method, the file to be uploaded is initially compressed to obtain an initial compressed file;

[0036] The file to be uploaded is parsed to determine whether compression quality information exists;

[0037] If so, a compressed file to be uploaded is generated based on the initial compressed file and the compression quality information.

[0038] The above technical solution optimizes the compression of files of different file types by using different compression methods, thereby obtaining the best compressed file to be uploaded. This avoids file loss, image or video file damage caused by compressing different files to the same degree, while improving the compression efficiency of files to be uploaded.

[0039] Optionally, the step of performing text content security detection on the compressed file to be uploaded and obtaining the text content security detection result includes:

[0040] The text content of the compressed file to be uploaded is matched with the text content of the preset abnormal program template to determine whether there is an abnormal executable program in the compressed file to be uploaded.

[0041] If so, the abnormal executable program will be sent to a third-party security testing agency for program security testing, in order to generate and return the program security testing results;

[0042] Based on the program security detection results, the text content security detection results are determined.

[0043] The above technical solution compares the text content of the compressed file to be uploaded with the text content of a preset abnormal program template to determine whether an abnormal executable program exists. The abnormal executable program is then sent to a third-party security testing agency for program security testing. The results of the text content security testing are then determined, improving the accuracy and reliability of the text content security testing of the compressed file to be uploaded, thereby achieving secure uploading of the file.

[0044] According to another aspect of the present invention, a file uploading device is provided, comprising:

[0045] The file acquisition module is used to acquire the file to be uploaded;

[0046] The security verification module is used to perform file security verification on the file to be uploaded and obtain the security verification result.

[0047] The upload method determination module is used to determine the target file upload method based on the file attribute information of the file to be uploaded if the security verification result is successful.

[0048] The file upload module is used to upload the file to be uploaded using the target file upload method.

[0049] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0050] At least one processor; and

[0051] A memory communicatively connected to the at least one processor; wherein,

[0052] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the file upload method according to any embodiment of the present invention.

[0053] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the file upload method described in any embodiment of the present invention.

[0054] The technical solution of this invention obtains the file to be uploaded; performs a file security verification on the file to be uploaded and obtains a security verification result; if the security verification result is successful, the target file upload method is determined based on the file attribute information of the file to be uploaded; and the file to be uploaded is performed using the target file upload method. The above technical solution improves the security of the file upload process by performing a file security verification on the file to be uploaded; and achieves targeted uploading of files with different file attributes by determining the target file upload method based on file attribute information, while also improving the file upload efficiency.

[0055] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

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

[0057] Figure 1 This is a flowchart of a file upload method provided according to Embodiment 1 of the present invention;

[0058] Figure 2 This is a flowchart of a file upload method provided according to Embodiment 2 of the present invention;

[0059] Figure 3This is a flowchart of a file upload method provided according to Embodiment 3 of the present invention;

[0060] Figure 4 This is a schematic diagram of a file upload device according to Embodiment 4 of the present invention;

[0061] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the file upload method of this invention. Detailed Implementation

[0062] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0063] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0064] Example 1

[0065] Figure 1 This is a flowchart of a file upload method provided in Embodiment 1 of the present invention. This embodiment is applicable to the secure upload of acquired files to be uploaded. This method can be executed by a file upload device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0066] S110. Obtain the file to be uploaded.

[0067] The file to be uploaded can be a file to be uploaded to the server, such as an image file, text file, spreadsheet file, script file, or video file.

[0068] The file to be uploaded can be sent actively by the web frontend, or the backend server can listen for the file upload behavior or event of the web frontend and actively retrieve the file to be uploaded after listening for the file upload behavior or event.

[0069] S120. Perform file security verification on the file to be uploaded and obtain the security verification result.

[0070] For example, after obtaining the file to be uploaded, the file can be parsed to determine whether there are any abnormal messages with security risks in the parsed file; if so, the security verification result of the file to be uploaded is determined to be that the security verification failed; if not, the security verification result of the file to be uploaded is determined to be that the security verification passed.

[0071] Optionally, before determining whether there are any abnormal messages in the file to be uploaded, it is also possible to determine whether the file to be uploaded is a malicious file. For example, a malicious file may be a malicious program file containing a virus. If so, the security verification result of the file to be uploaded is determined to be that the security verification failed. If not, it is further determined whether there are any abnormal messages in the file to be uploaded.

[0072] It should be noted that, in order to further improve the comprehensiveness of the security verification of uploaded files and the accuracy of the security verification results, a more precise and comprehensive security verification can be performed on the uploaded files based on their file type and information.

[0073] In one optional embodiment, performing a file security verification on the file to be uploaded to obtain a security verification result includes: determining a security detection file corresponding to the file type of the file to be uploaded; performing a first file security verification on the file to be uploaded using the security detection file to obtain a first security verification result; and obtaining file information of the file to be uploaded, including file size, text fields, and field values ​​corresponding to the text fields; performing a second file security verification on the file to be uploaded based on file size, text fields, and field values ​​to obtain a second security verification result; and generating a security verification result that includes the first security verification result and the second security verification result.

[0074] The file types can include image files, text files, table files, and video files, among others.

[0075] The security check file can be a template file used to verify the compliance of uploaded files. Different file types require different security check files, which can be pre-set by relevant technical personnel according to actual needs.

[0076] For example, different text templates can be set according to the type characteristics of different file types to obtain security detection files for the corresponding file types. The text templates can include the text specifications that the file content of the corresponding text type must conform to. For instance, a security detection file for image files can include basic image parameters such as color values ​​and dimensions; a security detection file for text files can include text titles and text descriptions.

[0077] For example, the security test file and the file to be uploaded can be matched using text templates. If the text content of the file to be uploaded can be successfully matched with the text template of the security test file, the first security check result is determined to be a successful security check; if the file to be uploaded contains text content that cannot be successfully matched with the text template of the security test file, the first security check result is determined to be a failed security check.

[0078] It should be noted that during the second file security verification process for uploaded files, different file information can correspond to different information verification methods, which can be pre-set by relevant technical personnel according to actual needs.

[0079] For example, the file size of the file to be uploaded can be validated based on a preset maximum file upload parameter. Here, file size represents the volume of the file to be uploaded; the maximum file upload parameter can be a threshold for the maximum allowed file size, which can be preset by relevant technical personnel. Specifically, if the file size of the file to be uploaded is not greater than the preset file size threshold, the file size validation is considered successful; if the file size of the file to be uploaded is greater than the preset file size threshold, the file size validation is considered unsuccessful.

[0080] For example, the information verification method for text fields can be whether the text field is unique and whether it is a required field. A field information comparison table can be pre-constructed by relevant technical personnel, which can include unique fields and required fields. Specifically, the text fields of the file to be uploaded are compared with the fields in the field information comparison table. If a matching text field exists, it is determined whether the corresponding text field meets the field uniqueness or required field condition; if so, the field verification of the corresponding text field is considered successful; otherwise, the field verification of the corresponding text field is considered unsuccessful. If all field verifications of the text fields in the file to be uploaded pass, the text field verification is considered successful; if any text field in the file to be uploaded fails verification, the text field verification is considered unsuccessful.

[0081] For example, the information validation method for text field values ​​can be to determine whether the field value is valid. For instance, for a text field specifying a selection word, its corresponding field value is a fixed value. If a value other than the fixed value is detected, the validity validation of that field value can be considered to have failed. Specifically, the validity validation of the field values ​​of the text fields in the uploaded text is performed. If the validity validation of all text field values ​​passes, the field value validation is considered successful; if the validity validation of any field value in any text field fails, the field value validation is considered to have failed.

[0082] For example, if the file volume verification result, text field verification result, and field value verification result are all verified as passed, then the second security verification result can be determined to be a security verification passed; if any of the file volume verification result, text field verification result, and field value verification result is verified as failed, then the second security verification result can be determined to be a security verification failed.

[0083] For example, if both the first security verification result and the second security verification result pass the security verification, then the security verification result of the file to be uploaded is determined to be a security verification success; if either the first security verification result or the second security verification result fails the security verification, then the security verification result of the file to be uploaded is determined to be a security verification failure.

[0084] This optional embodiment determines a security detection file corresponding to the file type of the file to be uploaded; performs a first file security verification on the file to be uploaded using the security detection file to obtain a first security verification result; and obtains the file information of the file to be uploaded; performs a second file security verification on the file to be uploaded based on the file size, text fields, and field values ​​to obtain a second security verification result; and generates a security verification result including the first security verification result and the second security verification result. The above technical solution improves the accuracy of determining the security verification result of the file to be uploaded by comprehensively considering the file type characteristics and file information characteristics of the file to be uploaded during the security detection process; and improves the comprehensiveness of the security verification of the file to be uploaded by comprehensively considering the security of the file from multiple perspectives.

[0085] S130. If the security verification result is successful, the upload method of the target file is determined based on the file attribute information of the file to be uploaded.

[0086] The file attribute information can include file size and file type. The target file upload method can be any method used to upload the file; for example, the target file upload method can be a third-party storage file upload method or a database storage file upload method.

[0087] One method involves third-party storage for file uploads. A third-party database service stores the files to be uploaded and sends the storage information back to the server, enabling the upload. Another method involves database storage for file uploads. Based on specific storage conditions, files that meet those conditions are stored in the server's local database, thus enabling the upload.

[0088] For example, the upload method can be determined based on the file size of the file to be uploaded. Specifically, if the file size does not exceed the set file size threshold, it indicates that the file size is small and can be uploaded and stored locally on the server. Therefore, the upload method can be determined as database storage file upload. If the file size exceeds the set file size threshold, it indicates that the file size is large. To avoid excessive consumption of local database memory on the server and low memory efficiency, the upload method can be determined as database storage file upload.

[0089] Optionally, the target file upload method can be determined based on the file type of the file to be uploaded. Specifically, relevant technical personnel can pre-define the correspondence between file types and file upload methods. For example, the file upload method corresponding to image files and video files can be third-party storage file upload; the file upload method corresponding to text files and table files can be database storage file upload. For instance, after obtaining the file to be uploaded, the target file upload method can be determined based on the file type of the file and the pre-stored correspondence between file types and file upload methods.

[0090] S140. Upload the file to be uploaded using the target file upload method.

[0091] For example, if the target file is uploaded via database storage, the file to be uploaded will be compressed and stored in the local database to complete the file upload.

[0092] In an optional embodiment, if the target file upload method is a third-party storage file upload method, then the target file upload method is used to upload the file to be uploaded, including: sending the file to be uploaded to a third-party storage platform for the third-party storage platform to store the file to be uploaded, generating and returning storage address information; after listening to the storage address information, storing the storage address information to complete the file upload of the file to be uploaded.

[0093] Among them, the third-party storage platform can be a third-party database service platform that can provide file storage services.

[0094] For example, the file to be uploaded is sent to a third-party storage platform. The third-party storage platform can store the file and determine the storage address information of the file to be uploaded. The third-party storage platform sends the storage address information to the server, and the server saves the storage address information in its local database. When the server retrieves the file to be uploaded later, it can retrieve it from the third-party storage platform according to the stored storage address information.

[0095] Optionally, when uploading files using third-party storage, the long upload process may lead to instability in the system network or the third-party server. Therefore, appropriate prompts can be generated during the file upload process. For example, if the third-party storage platform fails to store the file to be uploaded, a prompt message such as "File upload to third-party storage failed" can be generated; or, if the file is successfully uploaded to the third-party storage platform, but the file address storage information fails due to a problem with its own server, a prompt message such as "File address storage database failed" can be generated.

[0096] This optional embodiment sends the file to be uploaded to a third-party storage platform for storage. After receiving the storage address information from the third-party storage platform, it stores the storage address information to complete the file upload. This realizes how to upload the file using third-party storage. By storing only the storage address information from the third-party storage platform, the memory space occupied by the server is reduced, memory pressure is alleviated, and file upload efficiency is improved.

[0097] The technical solution of this invention obtains the file to be uploaded; performs a file security verification on the file to be uploaded and obtains a security verification result; if the security verification result is successful, the target file upload method is determined based on the file attribute information of the file to be uploaded; and the file to be uploaded is performed using the target file upload method. The above technical solution improves the security of the file upload process by performing a file security verification on the file to be uploaded; and achieves targeted uploading of files with different file attributes by determining the target file upload method based on file attribute information, while also improving the file upload efficiency.

[0098] Example 2

[0099] Figure 2 This is a flowchart of a file upload method provided in Embodiment 2 of the present invention. This embodiment is an optimization and improvement based on the above technical solutions.

[0100] Furthermore, if the target file upload method is a database storage file upload method, the step "upload the file to be uploaded using the target file upload method" is refined to "compress the file to be uploaded to obtain a compressed file to be uploaded; perform text content security detection on the compressed file to be uploaded to obtain a text content security detection result; if the text content security detection result is passed, store the file to be uploaded to complete the file upload of the file to be uploaded." This improves the file upload method for the file to be uploaded. It should be noted that parts not described in detail in this embodiment of the invention can be referred to in the descriptions of other embodiments.

[0101] like Figure 2 As shown, the method includes the following specific steps:

[0102] S210. Obtain the file to be uploaded.

[0103] S220. Perform file security verification on the file to be uploaded and obtain the security verification result.

[0104] S230. If the security verification result is successful, then determine the upload method of the target file based on the file attribute information of the file to be uploaded.

[0105] S240. If the target file is uploaded via database storage, the file to be uploaded is compressed to obtain a compressed file to be uploaded.

[0106] One option for uploading files via database storage is to store the file to be uploaded in a local database.

[0107] To further reduce server-side memory usage, the acquired files to be uploaded can be compressed to obtain a compressed file. Specifically, existing compression technologies can be used to compress the files. For example, a pre-defined, self-developed compression algorithm can be used to convert the file content to blob (binary large object) format.

[0108] It should be noted that, in order to further optimize the compression method of the files to be uploaded and avoid file loss, image or video file damage caused by compressing different files to the same degree, different compression methods can be used for different file types to achieve the best compressed files to be uploaded.

[0109] In one optional embodiment, compressing the file to be uploaded to obtain a compressed file to be uploaded includes: determining the target file compression method based on the file type of the file to be uploaded; performing initial compression on the file to be uploaded based on the target file compression method to obtain an initial compressed file; parsing the file to be uploaded to determine whether compression quality information exists; if so, generating the compressed file to be uploaded based on the initial compressed file and the compression quality information.

[0110] The file types can include image files, text files, table files, and video files, among others.

[0111] It should be noted that different file types exhibit different file attributes, and using the same compression method may result in the loss of certain characteristics or content for some file types. Therefore, different file compression methods can be used for different file types, and the specific compression methods for different file types can be pre-set by relevant technical personnel according to actual needs.

[0112] Taking an image file as an example, the file compression method is illustrated below. If the file to be uploaded is an image file, the region with the most identical colors, or the region containing a large number of consecutive color values, is obtained; the consecutive pixel color values, or color values ​​with the same color, are compressed to obtain the initial compressed file.

[0113] Understandably, to ensure the quality of files to be uploaded, users can set appropriate compression levels for their files based on their needs. Therefore, by parsing the files to be uploaded, it can be determined whether the user-defined or selected compression level information exists. If so, the initial compressed file is further processed based on this information; otherwise, the initial compressed file is determined to be the file to be uploaded.

[0114] The compression quality information may include user identification information and compression quality requirements. The compression quality requirements can be the file quality the user expects to be compressed; for example, compressing a 10MB image file to a size of 6-7MB would be considered a compression quality requirement. User identification information can be a user ID (IdentityDocument), used to uniquely identify the user.

[0115] For example, after determining that the file to be uploaded has compression quality information, a target security short code is determined based on the user identification information and compression quality requirements. The target security short code can be an independent, secure, and unique identifier generated based on time, user identification, and user key. Different user identifications and different compression quality requirements correspond to different security short codes. For example, if user A has compression quality requirement a, the corresponding security short code could be M1; if user A has compression quality requirement b, the corresponding security short code could be M2; if user B has compression quality requirement a, the corresponding security short code could be N1; if user B has compression quality requirement b, the corresponding security short code could be N2. Specifically, the pixel values ​​of the initial compressed file are assigned using the target security short code to obtain the assigned compressed file, which is then used as the compressed file to be uploaded.

[0116] This optional embodiment determines the target file compression method based on the file type of the file to be uploaded; based on the target file compression method, it performs initial compression on the file to be uploaded to obtain an initial compressed file; it then parses the file to be uploaded to determine if compression quality information exists; if so, it generates a compressed file to be uploaded based on the initial compressed file and the compression quality information. This technical solution optimizes the compression method for different file types of files to be uploaded by using different file compression methods, thus obtaining an optimal compressed file to be uploaded. This avoids file loss, image or video file damage caused by applying the same level of compression to different files to be uploaded, while also improving the compression efficiency of the file to be uploaded.

[0117] It is understandable that the file size of the file to be uploaded affects the file upload speed. When the file size of the file to be uploaded is too large, the speed and efficiency of file compression will decrease. Therefore, in order to ensure the efficiency and speed of the file upload process, large files to be uploaded can be split into chunks.

[0118] In an optional embodiment, before compressing the file to be uploaded to obtain a compressed file to be uploaded, the method further includes: determining the system type of the server system that uploads the file to be uploaded; determining whether to perform file fragmentation on the file to be uploaded based on the file size and system type; if so, determining the file fragmentation method based on the file type of the file to be uploaded; performing file fragmentation on the file to be uploaded using the file fragmentation method to obtain at least one fragmented file to be uploaded; and generating a file to be uploaded that includes at least one fragmented file to be uploaded.

[0119] The server system can be the server system used by the user uploading the file. The system type can be Windows or macOS, etc.

[0120] For example, different upload file size thresholds can be set for different system types. For instance, for Windows systems, the corresponding upload file size threshold could be 1024*1024*10B; for macOS systems, the corresponding upload file size threshold could be 1000*1024*10B. Specifically, if the determined system type is Windows and the file size to be uploaded does not exceed the corresponding upload file size threshold for Windows systems, then the file to be uploaded does not need to be fragmented; if the determined system type is Windows and the file size to be uploaded exceeds the corresponding upload file size threshold for Windows systems, then the file to be uploaded is fragmented. The determination method for other system types is the same as for Windows systems, and will not be elaborated further in this embodiment.

[0121] File splitting can be a method of dividing the file to be uploaded into a number of files and a file size that meet the requirements, according to a set file splitting size. Different file types may require different file splitting methods, which can be pre-set by relevant technical personnel according to actual needs. For example, different file splitting sizes can be set to obtain different numbers and sizes of split files.

[0122] For example, based on the file type of the file to be uploaded, a file segmentation method corresponding to the file type is determined. Based on the set file segment size corresponding to the file segmentation method, the file to be uploaded is segmented to obtain at least one segment file to be uploaded, and each segment file to be uploaded is used as the file to be uploaded.

[0123] This optional embodiment determines the system type of the server system uploading the file to be uploaded. Based on the file size and system type, it determines whether to perform file fragmentation on the file to be uploaded. If so, it uses the file fragmentation method corresponding to the file type to perform file fragmentation on the file to be uploaded. This achieves file fragmentation processing for large files to be uploaded, improving file upload speed and efficiency.

[0124] S250. Perform text content security checks on the uploaded compressed file and obtain the text content security check results.

[0125] For example, a text content security check can be performed on the compressed file to be uploaded, specifically checking for the presence of executable programs within the file's text. It should be noted that if the file's text content includes an executable program, it may be vulnerable to malicious execution. Therefore, if an executable program is detected in the text content of the compressed file to be uploaded, the text content security check result is determined to be a failure; if no executable program is detected in the text content of the compressed file to be uploaded, the text content security check result is determined to be a success.

[0126] Understandably, to further improve the accuracy and reliability of text content security detection for uploaded compressed files, thereby achieving secure uploading of files, text content security detection for uploaded files can also be performed by template matching using pre-set abnormal program templates.

[0127] In one optional embodiment, performing text content security detection on the compressed file to be uploaded to obtain a text content security detection result includes: matching the text content of the compressed file to be uploaded with the template text content of a preset abnormal program template to determine whether an abnormal executable program exists in the compressed file to be uploaded; if so, sending the abnormal executable program to a third-party security detection agency for program security detection to generate and return a program security detection result; and determining the text content security detection result based on the program security detection result.

[0128] Among them, the exception program template can be a program template containing an exception executable program, which can be preset by relevant technical personnel.

[0129] For example, the text content of the compressed file to be uploaded can be matched with the template text content of a preset abnormal program template. If the match is successful, it can be determined that there is an abnormal executable program in the compressed file to be uploaded; if the match fails, it can be determined that there is no abnormal executable program in the compressed file to be uploaded. If there is an abnormal executable program in the compressed file to be uploaded, the abnormal executable program is sent to a third-party security testing agency for program security verification; the program security verification result returned by the third-party security testing agency is used as the text content security verification result. If the program security verification result is passed, the text content security verification result is also passed; if the program security verification result is failed, the text content security verification result is also failed.

[0130] This optional embodiment of the solution matches the text content of the compressed file to be uploaded with the template text content of a preset abnormal program template to determine whether an abnormal executable program exists. The abnormal executable program is then sent to a third-party security testing agency for program security testing. The results of the text content security testing are determined, thereby improving the accuracy and reliability of the text content security testing of the compressed file to be uploaded, and thus achieving secure uploading of the file.

[0131] S260. If the text content security detection result is passed, the file to be uploaded is stored to complete the file upload.

[0132] For example, if the text content security detection result is passed, the file to be uploaded is stored to complete the file upload; if the text content security detection result is failed, a "file upload failed" message is generated and sent to the user of the file to be uploaded.

[0133] This embodiment's technical solution compresses the file to be uploaded, obtaining a compressed file. It then performs a text content security check on the compressed file, obtaining the security check result. If the security check passes, the file is stored, completing the upload process. This implements a database-based file upload method. Compressing the uploaded file reduces the storage pressure on the server-side database, thus improving storage efficiency. Furthermore, the text content security check on the compressed file enhances the security of the file to be uploaded.

[0134] Example 3

[0135] Figure 3 This is a flowchart of a file upload method provided in Embodiment 3 of the present invention. Based on the above embodiments, this embodiment provides a preferred example.

[0136] like Figure 3 As shown, the method includes the following specific steps:

[0137] S301. Obtain the file to be uploaded.

[0138] S302. Perform file security verification on the file to be uploaded and obtain the security verification result.

[0139] Optionally, based on the file type of the file to be uploaded, a security detection file corresponding to the file type is determined; the security detection file is used to perform a first file security check on the file to be uploaded to obtain a first security check result; the file information of the file to be uploaded is obtained; the file information includes the file size, text fields, and the field values ​​corresponding to the text fields; based on the file size, text fields, and field values, a second file security check is performed on the file to be uploaded to obtain a second security check result; a security check result including the first security check result and the second security check result is generated.

[0140] S303. If the security verification result is successful, determine the target file upload method based on the file attribute information of the file to be uploaded; if the target file upload method is a third-party file storage method, execute S304-S305; if the target file upload method is a database file upload method, execute S306-S313.

[0141] S304. If the target file is uploaded via a third-party storage file upload method, the file to be uploaded will be sent to the third-party storage platform for storage, and the platform will generate and return storage address information.

[0142] S305. After detecting the storage address information, store the storage address information to complete the file upload of the file to be uploaded.

[0143] S306. If the target file is uploaded via database storage file upload, then determine the system type of the server system uploading the file.

[0144] S307. Based on the file size and system type of the file to be uploaded, determine whether to perform file fragmentation on the file to be uploaded; if yes, execute S308; if no, execute S311.

[0145] S308. Determine the file segmentation method based on the file type of the file to be uploaded.

[0146] S309. Use file fragmentation to process the file to be uploaded into fragments, and obtain at least one fragment file to be uploaded.

[0147] S310. Generate a file to be uploaded that includes at least one file to be uploaded.

[0148] S311. Compress the file to be uploaded to obtain a compressed file to be uploaded.

[0149] Optionally, the target file compression method is determined based on the file type of the file to be uploaded; based on the target file compression method, the file to be uploaded is initially compressed to obtain an initial compressed file; the file to be uploaded is parsed to determine whether compression quality information exists; if so, the compressed file to be uploaded is generated based on the initial compressed file and the compression quality information.

[0150] S312. Perform text content security checks on the uploaded compressed file and obtain the text content security check results.

[0151] Optionally, the text content of the compressed file to be uploaded is matched with the template text content of a preset abnormal program template to determine whether an abnormal executable program exists in the compressed file to be uploaded; if so, the abnormal executable program is sent to a third-party security testing agency for program security testing to generate and return the program security testing results; based on the program security testing results, the text content security testing results are determined.

[0152] S313. If the text content security detection result is passed, then store the file to be uploaded to complete the file upload.

[0153] Example 4

[0154] Figure 4 This is a schematic diagram of a file upload device provided in Embodiment 4 of the present invention. The file upload device provided in this embodiment of the present invention is suitable for securely uploading acquired files to be uploaded. This file upload device can be implemented in hardware and / or software, such as... Figure 4 As shown, the device specifically includes: a file acquisition module 401, a security verification module 402, an upload method determination module 403, and a file upload module 404. Among them,

[0155] File acquisition module 401 is used to acquire the file to be uploaded;

[0156] Security verification module 402 is used to perform file security verification on the file to be uploaded and obtain security verification results;

[0157] The upload method determination module 403 is used to determine the target file upload method based on the file attribute information of the file to be uploaded if the security verification result is successful.

[0158] The file upload module 404 is used to upload the file to be uploaded using the target file upload method.

[0159] The technical solution of this invention obtains the file to be uploaded; performs a file security verification on the file to be uploaded and obtains a security verification result; if the security verification result is successful, the target file upload method is determined based on the file attribute information of the file to be uploaded; and the file to be uploaded is performed using the target file upload method. The above technical solution improves the security of the file upload process by performing a file security verification on the file to be uploaded; and achieves targeted uploading of files with different file attributes by determining the target file upload method based on file attribute information, while also improving the file upload efficiency.

[0160] Optionally, the security verification module 402 includes:

[0161] The security detection file determination unit is used to determine a security detection file corresponding to the file type of the file to be uploaded.

[0162] The first result determination unit is configured to perform a first file security verification on the file to be uploaded using the security detection file, and obtain a first security verification result; and

[0163] The file information acquisition unit is used to acquire the file information of the file to be uploaded; the file information includes the file size, a text field, and the field value corresponding to the text field.

[0164] The second result determination unit is used to perform a second file security check on the file to be uploaded based on the file size, the text field, and the field value, and obtain a second security check result;

[0165] The verification result generation unit is used to generate a security verification result that includes the first security verification result and the second security verification result.

[0166] Optionally, if the target file upload method is the third-party storage file upload method, then the file upload module 404 includes:

[0167] The address information feedback unit is used to send the file to be uploaded to a third-party storage platform so that the third-party storage platform can store the file to be uploaded and generate and feedback storage address information.

[0168] The address information storage unit is used to store the storage address information after it is detected, so as to complete the file upload of the file to be uploaded.

[0169] Optionally, if the target file upload method is the database storage file upload method, then the file upload module 404 includes:

[0170] The compressed file determination unit is used to compress the file to be uploaded to obtain a compressed file to be uploaded;

[0171] A security detection result determination unit is used to perform text content security detection on the compressed file to be uploaded and obtain the text content security detection result.

[0172] The file storage unit is used to store the file to be uploaded if the text content security detection result is passed, so as to complete the file upload of the file to be uploaded.

[0173] Optionally, the file upload module 404 further includes:

[0174] The system type determination unit is used to determine the system type of the server system that uploads the file to be uploaded before the file to be uploaded is compressed to obtain a compressed file to be uploaded.

[0175] The file segmentation judgment unit is used to determine whether to perform file segmentation processing on the file to be uploaded based on the file size of the file to be uploaded and the system type.

[0176] The file segmentation method determination unit is used to determine the file segmentation method based on the file type of the file to be uploaded if file segmentation processing is to be performed on the file to be uploaded.

[0177] The file segmentation unit is used to perform file segmentation processing on the file to be uploaded using the file segmentation method to obtain at least one file segment to be uploaded.

[0178] The file to be uploaded generation unit is used to generate a file to be uploaded that includes at least one file segment to be uploaded.

[0179] Optionally, the compressed file determining unit includes:

[0180] The compression method determination subunit is used to determine the compression method of the target file based on the file type of the file to be uploaded;

[0181] The initial compressed file determination subunit is used to perform initial compression on the file to be uploaded based on the target file compression method to obtain an initial compressed file;

[0182] The quality information judgment subunit is used to parse the file to be uploaded and determine whether there is compression quality information.

[0183] The compressed file generation subunit is used to generate a compressed file to be uploaded based on the initial compressed file and the compression quality information, if compression quality information exists.

[0184] Optionally, the security detection result determination unit includes:

[0185] The abnormal program determination subunit is used to perform text matching between the file text content of the compressed file to be uploaded and the template text content of the preset abnormal program template to determine whether there is an abnormal executable program in the compressed file to be uploaded.

[0186] The security result generation subunit is used to send the abnormal executable program to a third-party security testing agency for program security testing if an abnormal executable program is found, so as to generate and feed back the program security testing results.

[0187] The security detection result determination subunit is used to determine the text content security detection result based on the program security detection result.

[0188] The file upload device provided in the embodiments of the present invention can execute the file upload method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0189] Example 5

[0190] Figure 5 A schematic diagram of an electronic device 50 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, 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 processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0191] like Figure 5 As shown, the electronic device 50 includes at least one processor 51 and a memory, such as a read-only memory (ROM) 52 and a random access memory (RAM) 53, communicatively connected to the at least one processor 51. The memory stores computer programs executable by the at least one processor. The processor 51 can perform various appropriate actions and processes based on the computer program stored in the ROM 52 or loaded into the RAM 53 from storage unit 58. The RAM 53 can also store various programs and data required for the operation of the electronic device 50. The processor 51, ROM 52, and RAM 53 are interconnected via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.

[0192] Multiple components in electronic device 50 are connected to I / O interface 55, including: input unit 56, such as keyboard, mouse, etc.; output unit 57, such as various types of monitors, speakers, etc.; storage unit 58, such as disk, optical disk, etc.; and communication unit 59, such as network card, modem, wireless transceiver, etc. Communication unit 59 allows electronic device 50 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

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

[0194] In some embodiments, the file upload method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 50 via ROM 52 and / or communication unit 59. When the computer program is loaded into RAM 53 and executed by processor 51, one or more steps of the file upload method described above may be performed. Alternatively, in other embodiments, processor 51 may be configured to perform the file upload method by any other suitable means (e.g., by means of firmware).

[0195] 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-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0196] Computer programs used to implement the methods of the present invention 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, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0197] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0198] To provide interaction with a user, the systems and techniques described herein can 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 pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0199] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0200] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0201] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0202] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand 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 invention should be included within the scope of protection of this invention.

Claims

1. A file upload method, characterized in that, include: Get the file to be uploaded; Perform a file security check on the file to be uploaded and obtain the security check result; If the security verification result is successful, the upload method of the target file is determined according to the file attribute information of the file to be uploaded; wherein, the file attribute information includes the file type; The file to be uploaded is uploaded using the target file upload method described above. The step of performing file security verification on the file to be uploaded and obtaining the security verification result includes: Determine whether the file to be uploaded is a malicious file. If it is, determine that the security verification result of the file to be uploaded is that the security verification result has failed. If not, perform file parsing on the file to be uploaded and determine whether there are any abnormal messages with security risks in the parsed file to be uploaded. If it is, determine that the security verification result of the file to be uploaded is that the security verification result has failed. If not, determine that the security verification result of the file to be uploaded is that the security verification result has passed. Wherein, if the target file upload method is a database storage file upload method, then the step of uploading the file to be uploaded using the target file upload method includes: The file to be uploaded is compressed to obtain a compressed file to be uploaded; Perform text content security detection on the compressed file to be uploaded, and obtain the text content security detection result; The step of performing text content security detection on the compressed file to be uploaded, and obtaining the text content security detection result, includes: The text content of the compressed file to be uploaded is matched with the text content of the preset abnormal program template to determine whether there is an abnormal executable program in the compressed file to be uploaded. If so, the abnormal executable program will be sent to a third-party security testing agency for program security testing, in order to generate and return the program security testing results; Based on the program security detection results, the text content security detection results are determined.

2. The method according to claim 1, characterized in that, The step of performing file security verification on the file to be uploaded and obtaining the security verification result further includes: Based on the file type of the file to be uploaded, determine the security detection file corresponding to the file type; The security detection file is used to perform a first file security verification on the file to be uploaded, and a first security verification result is obtained; and, Obtain the file information of the file to be uploaded; the file information includes the file size, a text field, and the field value corresponding to the text field. Based on the file size, the text field, and the field value, a second file security check is performed on the file to be uploaded to obtain a second security check result. Generate a security verification result that includes the first security verification result and the second security verification result.

3. The method according to claim 1, characterized in that, If the target file upload method is a third-party storage file upload method, then the step of uploading the file to be uploaded using the target file upload method includes: The file to be uploaded is sent to a third-party storage platform so that the third-party storage platform can store the file to be uploaded and generate and return storage address information; After detecting the storage address information, the storage address information is stored to complete the file upload of the file to be uploaded.

4. The method according to claim 1, characterized in that, If the text content security detection result is passed, the file to be uploaded is stored to complete the file upload.

5. The method according to claim 4, characterized in that, Before compressing the file to be uploaded to obtain a compressed file to be uploaded, the method further includes: Determine the system type of the server system from which the file to be uploaded is uploaded; Based on the file size of the file to be uploaded and the system type, determine whether to perform file fragmentation on the file to be uploaded; If so, determine the file fragmentation method based on the file type of the file to be uploaded; The file to be uploaded is split into at least one file to be uploaded using the file splitting method described above. Generate a file to be uploaded that includes at least one file segment to be uploaded.

6. The method according to claim 4, characterized in that, The step of compressing the file to be uploaded to obtain a compressed file to be uploaded includes: Determine the target file compression method based on the file type of the file to be uploaded; Based on the target file compression method, the file to be uploaded is initially compressed to obtain an initial compressed file; The file to be uploaded is parsed to determine whether compression quality information exists; If so, a compressed file to be uploaded is generated based on the initial compressed file and the compression quality information.

7. A file upload device, characterized in that, include: The file acquisition module is used to acquire the file to be uploaded; The security verification module is used to perform file security verification on the file to be uploaded and obtain the security verification result. The upload method determination module is used to determine the upload method of the target file based on the file attribute information of the file to be uploaded if the security verification result is successful; wherein, the file attribute information includes the file type; The file upload module is used to upload the file to be uploaded using the target file upload method. The security verification module is specifically used for: Determine whether the file to be uploaded is a malicious file. If it is, determine that the security verification result of the file to be uploaded is that the security verification result has failed. If not, perform file parsing on the file to be uploaded and determine whether there are any abnormal messages with security risks in the parsed file to be uploaded. If it is, determine that the security verification result of the file to be uploaded is that the security verification result has failed. If not, determine that the security verification result of the file to be uploaded is that the security verification result has passed. Wherein, if the target file upload method is a database storage file upload method, then the file upload module includes: The compressed file determination unit is used to compress the file to be uploaded to obtain a compressed file to be uploaded; A security detection result determination unit is used to perform text content security detection on the compressed file to be uploaded and obtain the text content security detection result. The security detection result determination unit includes: The abnormal program determination subunit is used to perform text matching between the file text content of the compressed file to be uploaded and the template text content of the preset abnormal program template to determine whether there is an abnormal executable program in the compressed file to be uploaded. The security result generation subunit is used to send the abnormal executable program to a third-party security testing agency for program security testing if an abnormal executable program is found, so as to generate and feed back the program security testing results. The security detection result determination subunit is used to determine the text content security detection result based on the program security detection result.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the file upload method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the file upload method according to any one of claims 1-6.

Citation Information

Patent Citations

  • File storage method and system

    CN109981702A

  • File uploading method, device and system and computer equipment

    CN112422604A

  • File uploading method and device, file downloading method and device, computer equipment and storage medium

    CN112565393A

  • File safety verification method, device and equipment and storage medium

    CN112738085A

  • File uploading method and device

    CN114827130A