CN109598131B - File uploading and downloading method and device, electronic equipment and storage medium - Google Patents

File uploading and downloading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN109598131B
CN109598131B CN201811158068.7A CN201811158068A CN109598131B CN 109598131 B CN109598131 B CN 109598131B CN 201811158068 A CN201811158068 A CN 201811158068A CN 109598131 B CN109598131 B CN 109598131B
Authority
CN
China
Prior art keywords
file
target file
target
identification information
name
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811158068.7A
Other languages
Chinese (zh)
Other versions
CN109598131A (en
Inventor
张志亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing happy I unlimited Technology Co., Ltd.
Original Assignee
Beijing Lewo Wuxian Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Lewo Wuxian Technology Co ltd filed Critical Beijing Lewo Wuxian Technology Co ltd
Priority to CN201811158068.7A priority Critical patent/CN109598131B/en
Publication of CN109598131A publication Critical patent/CN109598131A/en
Application granted granted Critical
Publication of CN109598131B publication Critical patent/CN109598131B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Bioethics (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a file uploading method, a file downloading method, a file uploading device, a file downloading device, electronic equipment and a storage medium, wherein the file uploading method comprises the following steps: acquiring a first target file; determining file content identification information of the first target file, wherein the file content identification information is information for identifying the content of the first target file; determining a file name corresponding to the first target file according to the file content identification information; renaming the first target file by using the file name, and uploading the renamed first target file. Since the file name contained in the uploading address can identify the content of the first target file, after the first target file is downloaded, the first target file can be determined to be tampered or replaced, so that the problem that the commercial secret or property security of a user is threatened due to the fact that the file is tampered or replaced is avoided.

Description

File uploading and downloading method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of file management technologies, and in particular, to a method and an apparatus for uploading and downloading a file, an electronic device, and a storage medium.
Background
In the digital information age, no matter the management of personal work and study, or the management of company for employee and business, the digital information system is not left. Taking the management of a company on business as an example, for a company, a large amount of management data is generated every day, and a large amount of files are formed.
In order to record and store the file or perform further data processing, the file needs to be uploaded to a corresponding preset database or a server. The current file uploading mode generally comprises: the operator uploads the file to be uploaded to a preset database or a server through a specific interface, and the preset database or the server returns an address for storing the file, namely an uploading address. The upload address typically ends with a file name, e.g., for upload address http:// www.test.com/bucket/test. When the user needs to use the file, the file with the file name of test can be obtained according to the uploading address.
In the process of uploading and downloading the file, the file may be tampered or replaced by an illegal file, but even if the file is tampered or replaced, the file name of the file does not change, so that operators and users cannot know whether the file is tampered or replaced, and once the file is tampered or replaced, unexpected consequences are caused to the trade secret or property safety of the users.
Disclosure of Invention
The embodiment of the invention aims to provide a file uploading and downloading method, a file uploading and downloading device, electronic equipment and a storage medium, so as to avoid the problem that the trade secret or property security of a user is threatened due to the fact that a file is tampered or replaced in the file uploading and downloading process. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a file uploading method, where the method includes:
acquiring a first target file;
determining file content identification information of the first target file, wherein the file content identification information is information for identifying the content of the first target file;
determining a file name corresponding to the first target file according to the file content identification information;
and renaming the first target file by using the file name, and uploading the renamed first target file.
Optionally, the step of determining the file content identification information of the first target file includes:
and calculating the MD5 encrypted value of the first target file according to an information digest algorithm to serve as the file content identification information of the first target file.
Optionally, after the step of uploading the renamed first target file, the method further includes:
and acquiring the uploading address of the renamed first target file.
Optionally, before the step of uploading the renamed first target file, the method further includes:
acquiring an original file name of the first target file;
the step of uploading the renamed first target file comprises:
and uploading the renamed first target file, and uploading an original file name of the first target file.
Optionally, after the step of determining the file name corresponding to the first target file according to the file content identification information, the method further includes:
and recording the corresponding relation between the first target file and the determined file name.
Optionally, the step of recording the correspondence between the first target file and the determined file name includes:
acquiring an original file name of the first target file;
and recording the corresponding relation between the original file name of the first target file and the determined file name.
In a second aspect, an embodiment of the present invention provides a file downloading method, where the method includes:
downloading a second target file;
calculating file content identification information of the second target file;
judging whether the file content identification information is matched with a file name contained in a download address of the second target file;
if so, determining that the second target file is a normal file.
Optionally, the step of calculating file content identification information of the second target file includes:
and calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
Optionally, when it is determined that the file content identification information does not match the file name included in the download address of the target file, the method further includes:
determining that the second target file is an abnormal file;
and reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
Optionally, after the step of determining that the second target file is an abnormal file, the method further includes:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
Optionally, the method further includes:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
Optionally, the step of downloading the second target file includes:
downloading a second target file and downloading an original file name of the second target file;
after the step of determining that the second target file is a normal file, the method further comprises:
and modifying the file name of the second target file into the original file name.
In a third aspect, an embodiment of the present invention provides a file uploading apparatus, where the apparatus includes:
the target file acquisition module is used for acquiring a first target file;
a first identification information determining module, configured to determine file content identification information of the first target file, where the file content identification information is information that identifies content of the first target file;
the file name determining module is used for determining a file name corresponding to the first target file according to the file content identification information;
and the renaming module is used for renaming the first target file by using the file name and uploading the renamed first target file.
Optionally, the first identification information determining module includes:
and the first identification information determining unit is used for calculating the MD5 encrypted value of the first target file according to an information digest algorithm to serve as the file content identification information of the first target file.
Optionally, the apparatus further comprises:
and the uploading address acquisition module is used for acquiring the uploading address of the renamed first target file after the renamed first target file is uploaded.
Optionally, the apparatus further comprises:
the file name acquisition module is used for acquiring the original file name of the first target file before uploading the renamed first target file;
the renaming module comprises:
and the file name uploading unit is used for uploading the renamed first target file and uploading the original file name of the first target file.
Optionally, the apparatus further comprises:
and the first recording module is used for recording the corresponding relation between the first target file and the determined file name after the file name corresponding to the first target file is determined according to the file content identification information.
Optionally, the first recording module includes:
a file name acquisition unit, configured to acquire an original file name of the first target file;
and the first recording unit is used for recording the corresponding relation between the original file name of the first target file and the determined file name.
In a fourth aspect, an embodiment of the present invention provides a file downloading apparatus, where the apparatus includes:
the target file downloading module is used for downloading a second target file;
the second identification information determining module is used for calculating the file content identification information of the second target file;
the judging module is used for judging whether the file content identification information is matched with a file name contained in a download address of the second target file;
and the normal file determining module is used for determining that the second target file is a normal file when the file content identification information is matched with the file name contained in the download address of the second target file.
Optionally, the second identification information determining module includes:
and the second identification information determining unit is used for calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
Optionally, the apparatus further comprises:
the abnormal file determining module is used for determining the second target file as an abnormal file when judging that the file content identification information is not matched with the file name contained in the download address of the target file;
and the abnormal message reporting module is used for reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
Optionally, the apparatus further comprises:
and the second recording module is used for recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file after the second target file is determined to be the abnormal file.
Optionally, the apparatus further comprises:
and the corresponding relation sending module is used for sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
Optionally, the target file downloading module includes:
the file name downloading unit is used for downloading a second target file and downloading the original file name of the second target file;
the device further comprises:
and the file name modifying module is used for modifying the file name of the second target file into the original file name after the second target file is determined to be the normal file.
On the other hand, an embodiment of the present invention provides an electronic device, including a first processor, a first communication interface, a first memory, and a first communication bus, where the first processor, the first communication interface, and the first memory complete communication with each other through the first communication bus;
a first memory for storing a computer program;
the first processor is configured to implement any one of the file uploading method steps when executing the program stored in the first memory.
On the other hand, another electronic device is provided in an embodiment of the present invention, and is characterized in that the electronic device includes a second processor, a second communication interface, a second memory, and a second communication bus, where the second processor, the second communication interface, and the second memory complete communication with each other through the second communication bus;
a second memory for storing a computer program;
and the second processor is used for realizing any one of the file downloading method steps when executing the program stored in the second memory.
In another aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when executed by a processor, the computer program implements any of the file uploading method steps described above.
On the other hand, another computer-readable storage medium is provided in an embodiment of the present invention, and is characterized in that a computer program is stored in the computer-readable storage medium, and when being executed by a processor, the computer program implements any of the file downloading method steps described above.
In the scheme provided by the embodiment of the invention, the electronic equipment acquires the target file, then determines the file content identification information of the target file, wherein the file content identification information is information for identifying the content of the target file, then determines the file name corresponding to the first target file according to the file content identification information, then renames the first target file by using the file name, and uploads the renamed first target file. Therefore, after the first target file is downloaded, whether the file content identification information is matched with the file name contained in the download address of the first target file can be judged, and if so, the first target file is determined to be a normal file. Since the file name contained in the uploading address can identify the content of the first target file, the first target file can be determined to be tampered or replaced, so that the problem that the commercial secret or property security of the user is threatened due to the fact that the file is tampered or replaced is avoided.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a file uploading method according to an embodiment of the present invention;
fig. 2 is a first flowchart of a file downloading method according to an embodiment of the present invention;
fig. 3 is a second flowchart of a file downloading method according to an embodiment of the present invention;
fig. 4 is a specific flowchart of a file uploading and downloading method according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a file uploading apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a file downloading device according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to avoid the problem that the trade secret or property security of a user is threatened due to the fact that a file is tampered or replaced in the file uploading and downloading processes, the embodiment of the invention provides a file uploading and downloading method, a file downloading device, an electronic device and a computer readable storage medium.
First, a file uploading method provided by an embodiment of the present invention is described below.
The file uploading method provided by the embodiment of the invention can be applied to any electronic equipment needing to upload files, such as a mobile phone, a computer, a processor and the like, and is not particularly limited herein. In order to facilitate uploading of the file to the preset database or the server, the electronic device may be in communication connection with the preset database or the server for data transmission.
As shown in fig. 1, a method for uploading a file includes:
s101, acquiring a first target file;
s102, determining file content identification information of the first target file;
wherein the file content identification information is information identifying the content of the first target file.
S103, determining a file name corresponding to the first target file according to the file content identification information;
s104, renaming the first target file by using the file name, and uploading the renamed first target file.
As can be seen, in the scheme provided in the embodiment of the present invention, the electronic device obtains the first target file, then determines the file content identification information of the first target file, where the file content identification information is information identifying the content of the first target file, then determines the file name corresponding to the first target file according to the file content identification information, then renames the first target file by using the file name, and uploads the renamed first target file. Therefore, after the first target file is downloaded, whether the file content identification information is matched with the file name contained in the download address of the first target file can be judged, and if so, the first target file is determined to be a normal file. Since the file name contained in the uploading address can identify the content of the first target file, whether the first target file is tampered or replaced can be determined, and therefore the problem that the commercial secret or property security of a user is threatened due to the fact that the file is tampered or replaced is avoided.
In step S101, the electronic device may first obtain a first target file, where the first target file is a file that needs to be uploaded to a preset database or a server. It is reasonable that the first target file may be a file stored locally by the electronic device, or may be a file sent by another electronic device and received by the electronic device.
In one embodiment, the electronic device may obtain the first target file according to a file uploading instruction issued by a user. When a certain file needs to be uploaded, a user can select a certain file in the electronic equipment, and then the electronic equipment can obtain a file uploading instruction, so that the selected file is determined to be the first target file. Certainly, the electronic device may also display a file name input box, and the user may input the file name in the input box when the file needs to be uploaded, so that the electronic device may obtain a file uploading instruction, and further determine that the file corresponding to the file name is the first target file.
In another embodiment, a user may preset a file storage area, where the file storage area is used to store files to be uploaded, and the electronic device may obtain files stored in the file storage area according to preset time, where the files are the first target files. The preset time may be 1 hour, 5 hours, 24 hours, etc., and is not particularly limited herein.
After acquiring the first target file, the electronic device may determine the file content identification information of the first target file, that is, execute step S102. The file content identification information is information that can identify the content of the first target file, and the file content identification information is information that can uniquely determine the file content, that is, the file content identification information corresponding to files with different contents is different, and the file content identification information corresponding to files with the same content is the same.
The electronic device may determine the file content identification information of the first target file according to a preset rule, as long as it is ensured that the file content identification information corresponding to the files with different contents is different, and the file content identification information corresponding to the files with the same contents is the same. The file content identification information may be one or a combination of letters, numbers, characters, etc., and is not specifically limited herein. For clarity and technical clarity, the following description will discuss an example of a method for determining the file content identification information of the first target file.
Next, in step S103, the electronic device may determine a file name corresponding to the first target file according to the file content identification information determined in step S102.
In order to determine whether the file is tampered or replaced when the file is downloaded, the electronic device may determine a file name corresponding to the first target file according to the file content identification information before uploading the first target file. In this way, the file name of the first target file may identify the content of the first target file.
In one embodiment, the electronic device may use the determined file content identification information of the first target file as the file name of the first target file. For example, if the file content identification information of the first target file determined by the electronic device is CN129673ah46578Poe0Y339, the electronic device may determine that the file name of the first target file is CN129673ah46578Poe0Y 339.
In another embodiment, the electronic device may perform preset processing on the determined file content identification information of the first target file, and use the processed file content identification information as a file name of the first target file. The specific manner of the preset processing may be to add a suffix after the file content identification information, add a prefix before the file content identification information, replace the information at the preset position or the preset character in the file content identification information with a target character, and the like, which is not limited herein.
For example, the electronic device determines that the file content identification information of the first target file is CN129673ah46578Poe0Y339, and then the electronic device adds a suffix wjm to the file content identification information, so that the file name of the first target file can be determined to be CN129673ah46578Poe0Y339wjm. The electronic device may prefix the file content identification information with the sch, and then may determine that the file name of the first object file is schCN129673ah46578Poe0Y 339. Of course, the electronic device may also replace all 9 in the file content identification information with 7, and then may determine that the file name of the first target file is CN127673ah46578Poe0Y337.
After determining the file name of the first target file, the electronic device may execute step S104, that is, rename the first target file by using the file name, and upload the renamed first target file. It is understood that when the electronic device uploads the renamed first target file, the file content of the first target file is unchanged, and the file name may identify the file content of the first target file.
The file name included in the uploading address corresponding to the renamed first target file is the file name used in renaming, for example, if the file name renamed for the first target file by the electronic device is CN127673ah46578Poe0Y337, the uploading address of the renamed first target file may be http:// www.test.com/bucket/cn127673ah46578poe0y337.
As an implementation manner of the embodiment of the present invention, the step of determining the file content identification information of the first target file may include:
and calculating the MD5 encrypted value of the first target file according to an information digest algorithm to serve as the file content identification information of the first target file.
The message digest algorithm processes incoming messages in 512-bit packets, each of which is divided into 16 32-bit sub-packets, and after a series of processing, the output of the algorithm consists of four 32-bit packets, which are concatenated to produce a 128-bit hash value. The MD5 encrypted values corresponding to files with the same content are the same, and the MD5 encrypted values corresponding to files with different contents are different, so that the electronic device may calculate the MD5 encrypted value of the first target file by using the information digest algorithm, and use the MD5 encrypted value as the file content identification information of the first target file.
For example, the electronic device calculates the MD5 cryptographic value of the first target file to be Qdg2546897e354694ot154267845y318 according to the information digest algorithm, and then the electronic device may determine the file content identification information of the first target file to be Qdg2546897e354694ot154267845y 318.
As can be seen, in this embodiment, the electronic device may calculate the MD5 encrypted value of the first target file according to the information digest algorithm, and use it as the file content identification information of the first target file. Since the MD5 encrypted value of the file can uniquely identify the file content, the electronic device can accurately determine the file content identification information of the first target file by using the MD5 encrypted value as the file content identification information, so that the file content identification information can accurately identify the file content of the first target file.
As an implementation manner of the embodiment of the present invention, after the step of uploading the renamed first target file, the method may further include:
and acquiring the uploading address of the renamed first target file.
In order to inform the user of the uploaded address of the renamed first target file which has been uploaded, and facilitate subsequent searching or downloading of the uploaded renamed first target file, after the renamed first target file is uploaded, the electronic device may obtain the uploaded address of the renamed first target file.
After the electronic device uploads the renamed first target file to a preset database or a server, the preset database or the server stores the renamed first target file to a fixed position, a storage address, namely an uploading address, of the to-be-renamed first target file is obtained, the uploading address is sent to the electronic device by the general preset database or the server, and the electronic device can obtain the uploading address.
Of course, it is reasonable that the electronic device may also send the acquisition request to the preset database or the server, so that the preset database or the server sends the upload address to the electronic device.
After the upload address of the first target file to be renamed is acquired, the electronic device may display the upload address so that the user may record the upload address in order to facilitate the user to record the upload address. The uploading address can also be sent to an electronic device bound by the user, such as a mobile phone of the user, so as to inform the user of successfully uploading the file to be uploaded.
As can be seen, in this embodiment, after uploading the renamed first target file, the electronic device may obtain the upload address of the renamed first target file to record or inform the user of the upload address of the renamed first target file, so as to search or download the renamed first target file in the following process, thereby improving user experience.
As an implementation manner of the embodiment of the present invention, before the step of uploading the renamed first target file, the method may further include:
and acquiring the original file name of the first target file.
Since the file name of the file may generally represent some characteristics of the file, such as a related type of the file content, a source of the file, and the like, in order to obtain the related information of the first target file, the electronic device may obtain an original file name of the first target file before the step of uploading the renamed first target file. The original file name is the file name before the first target file is not renamed.
Correspondingly, the step of uploading the renamed first target file may include:
and uploading the renamed first target file, and uploading an original file name of the first target file.
In order to enable a user who downloads the first target file to know the original file name of the first target file, the electronic device may upload the original file name of the first target file while uploading the renamed first target file.
In this way, the preset database or the server may record the original file name of the renamed first target file while storing the renamed first target file. When the user downloads the renamed first target file, the original file name of the renamed first target file can be issued together, and the user can also know the original file name of the first target file and further know the relevant information about the first target file.
It can be seen that, in this embodiment, before the step of uploading the renamed first target file, the electronic device may obtain an original file name of the first target file, and further upload the original file name of the first target file while uploading the renamed first target file, so that when the user downloads the first target file, the user may download the original file name of the first target file at the same time to obtain related information about the first target file.
As an implementation manner of the embodiment of the present invention, after the step of determining the file name corresponding to the first target file according to the file content identification information, the method may further include:
and recording the corresponding relation between the first target file and the determined file name.
In order to facilitate management of the uploaded files, after determining a file name corresponding to the first target file according to the file content identification information, the electronic device may record a corresponding relationship between the first target file and the determined file name. Thus, when the uploaded file information is searched for subsequently, the file name of the first target file can be renamed and uploaded.
For example, if the first target file is identified as file a and the file name determined by the electronic device is Qdg2546897e354694ot154267845y318, then the electronic device may record Qdg2546897e354694ot154267845y318 corresponding to file a, so that when the uploaded files are subsequently managed, it may be determined that the first target file identified as file a was uploaded under the file name Qdg2546897e354694ot154267845y 318.
Moreover, if the electronic device needs to download or maintain the uploaded first target file, the file with the file name of Qdg2546897e354694ot154267845y318, that is, the first target file, may be downloaded from a preset database or a server.
As can be seen, in this embodiment, after determining the file name corresponding to the first target file according to the file content identification information, the electronic device may record the corresponding relationship between the first target file and the determined file name, so as to subsequently manage the uploaded file.
As an implementation manner of the embodiment of the present invention, the step of recording the correspondence between the first target file and the determined file name may include:
acquiring an original file name of the first target file; and recording the corresponding relation between the original file name of the first target file and the determined file name.
Since the file name of the file may generally represent some characteristics of the file, for example, the related type of the file content, the source of the file, and the like, in this embodiment, the electronic device may obtain the original file name of the first target file, further use the original file name as the identifier of the first target file, and record the corresponding relationship between the original file name of the first target file and the determined file name.
For example, if the original file name of the first target file is video m and the file name determined by the electronic device for the first target file is Qdg2546897e354694ot154267845y318, then the electronic device may record Qdg2546897e354694ot154267845y318 corresponding to video m. Thus, if a file for video m needs to be searched in subsequent management of uploaded files, a file having a file name of Qdg2546897e354694ot154267845y318 may be downloaded from a preset database or server.
As can be seen, in this embodiment, the electronic device may obtain an original file name of the first target file, and record a corresponding relationship between the original file name of the first target file and the determined file name. Therefore, when the uploaded files are managed subsequently, the needed files can be searched more pertinently and more quickly.
Corresponding to the file uploading method, the embodiment of the invention also provides a file downloading method.
First, a first file downloading method provided in an embodiment of the present invention is described below.
The first file downloading method provided in the embodiment of the present invention may also be applied to any electronic device that needs to download a file, for example, a mobile phone, a computer, a processor, and the like, which is not limited herein. To facilitate downloading of files from a predetermined database or server, the electronic device may be communicatively coupled to the predetermined database or server for data transfer.
As shown in fig. 2, a file downloading method includes:
s201, downloading a second target file;
s202, calculating file content identification information of the second target file;
s203, judging whether the file content identification information is matched with a file name contained in a download address of the second target file; if yes, go to step S204; if not, determining that the second target file is an abnormal file;
s204, determining the second target file to be a normal file.
It can be seen that, in the scheme provided in the embodiment of the present invention, after the electronic device downloads the second target file, the file content identification information of the second target file may be calculated, and then it is determined whether the file content identification information matches with the file name included in the download address of the second target file, if so, it is determined that the second target file is a normal file, and if not, it is determined that the second target file is an abnormal file. Therefore, after the electronic equipment downloads the second target file, whether the file content identification information is matched with the file name contained in the download address of the second target file or not can be judged, and the file name contained in the upload address can identify the content of the second target file, so that whether the second target file is tampered or replaced or not can be determined, and the problem that the commercial secret or property safety of a user is threatened due to the fact that the file is tampered or replaced is avoided.
In step S201, the electronic device may download a second object file, where the second object file is a file that needs to be downloaded from a preset database or a server. The second target file may be the first target file, or may not be the first target file, and it may be any file stored in a preset database or a server that needs to be downloaded, which is reasonable.
In one embodiment, the electronic device may download the second target file according to a file download instruction issued by a user. When a certain file needs to be downloaded, the user can input the file identifier in the file identifier input box displayed by the electronic equipment, so that the electronic equipment can obtain a file downloading instruction, and further determine that the file corresponding to the file identifier is the second target file.
In another embodiment, the user may preset a file downloading time, and the electronic device may download a certain file or certain files, that is, the second target file, from a preset database or a server according to the preset time. The preset time may be 1 hour, 5 hours, 24 hours, etc., and is not particularly limited herein.
After downloading the second target file, the electronic device may calculate the file content identification information of the second target file, that is, execute the step S202. The file content identification information of the second target file is information capable of identifying the file content of the second target file, and the calculation mode of the file content identification information of the second target file is the same as the mode of determining the file content identification of the first target file, so that the same file content identification information can be obtained for files with the same file content, and different file content identification information can be obtained for files with different file contents.
Next, in step S203, the electronic device may determine whether the file content identification information of the second target file matches the file name included in the download address of the second target file, if so, it indicates that the file content of the second target file is not tampered or replaced, then step S204 may be executed, that is, it is determined that the second target file is a normal file; if the file content identification information of the second target file does not match the file name contained in the download address of the second target file, which indicates that the file content of the second target file has been tampered or replaced, the electronic device may determine that the second target file is an abnormal file.
Since the file name is renamed according to the file content identification information of the file when the file is uploaded, the file name contained in the download address of the second target file is the file name renamed according to the file content identification information of the second target file when the second target file is uploaded, and the file name also identifies the file content of the second target file when the second target file is uploaded.
Then, if the second target file is tampered or replaced within the period of time from the uploading to the downloading, the file content of the second target file downloaded by the electronic device has changed, and the calculated file content identification information does not match the file name contained in the download address of the second target file. If the second target file is not tampered or replaced in the time period from uploading to downloading, the file content of the second target file downloaded by the electronic device is not changed, and the calculated file content identification information is matched with the file name contained in the download address of the second target file, so that whether the second target file is tampered or replaced can be determined by judging whether the file content identification information of the second target file is matched with the file name contained in the download address of the second target file.
For example, assuming that the file content identification information of the second target file determined by the electronic device is CN129673ah46578Poe0Y339, the download address of the second target file is http:// www.test.com/buck/CN129673ah46578Poe0Y339wjm.zip, and the rule for renaming the second target file when uploading the second target file is that a suffix wjm is added after the file content identification information of the second target file, it can be seen that the file name contained in the download address of the second target file is CN129673ah46578Poe0Y339wjm, which is matched with the file content identification information of the second target file is CN129673ah46578Poe0Y339, so that the second target file can be determined to be a normal file, which has not been tampered or replaced.
As an implementation manner of the embodiment of the present invention, in a case that the MD5 encrypted value of the file is used as the file content identification information when the file is uploaded, the step of calculating the file content identification information of the second target file may include:
and calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
In order to ensure that the way of calculating the file content identification information of the second target file is the same as the way of determining the file content identification information of the second target file when the second target file is uploaded, and ensure that the result of judging whether the file content identification information of the second target file is matched with the file name contained in the download address of the second target file is correct, for the case that the MD5 encrypted value of the file is adopted as the file content identification information when the file is uploaded, the electronic device can calculate the MD5 encrypted value of the second target file according to an information digest algorithm, and take the MD5 encrypted value as the file content identification information of the second target file.
For example, the electronic device calculates the MD5 encrypted value of the second target file to be Mgt2543467e354694r1542i67115o240 according to the message digest algorithm, so that the electronic device can determine the file content identification information of the second target file to be Mgt2543467e354694r1542i67115o 240.
It can be seen that, in the embodiment of the present invention, the electronic device may calculate, according to the information digest algorithm, the MD5 encrypted value of the second target file, and use the MD5 encrypted value as the file content identification information of the second target file. In this way, the file content of the second target file can be accurately determined, and whether the second target file is tampered or replaced can be further determined.
When the content identification information of the second target file does not match the file name contained in the download address of the second target file, the electronic device may determine that it is an abnormal file. After the step of determining that the second target file is an abnormal file, as an implementation manner of the embodiment of the present invention, the method may further include:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
In order to determine the abnormal reason of the second target file, count the abnormal file information, and the like, the electronic device may record a corresponding relationship between the file content identification information of the second target file and a file name included in the download address of the second target file.
For example, assuming that the file content identification information of the second object file determined by the electronic device is ty568941p43298iof0637 063 0637h, and the file name contained in the download address of the second object file is CN129673ah46578Poe0Y339, which are not matched, at this time, the electronic device may record the file name CN129673ah46578Poe0Y339 corresponding to the file content identification information ty568941p43298iof0637 h.
As can be seen, in this embodiment, after determining that the second target file is an abnormal file, the electronic device may record a corresponding relationship between file content identification information of the second target file and a file name included in a download address of the second target file. Thus, the abnormal reason of the second target file can be conveniently determined, the abnormal file information can be conveniently counted and the like.
As an implementation manner of the embodiment of the present invention, in a case that the electronic device records a correspondence between file content identification information of the second target file and a file name included in a download address of the second target file, the method may further include:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server.
In order to further determine the problem of the abnormal file, the electronic device may associate the file content identification information of the second target file with the file name included in the download address of the second target file, so that the server may receive the association, and further may determine the abnormal information of the second target file, for example, which parts of the second target file are tampered with, according to the file content identification information of the second target file and the file name included in the download address of the second target file.
For example, the electronic device sends the corresponding relationship between the file content identification information ty568941p43298iof0637h and the file name CN129673ah46578Poe0Y339 to the server, so that the server can know that the file with the file name CN129673ah46578Poe0Y339 is tampered or replaced, the file content identification information becomes ty568941p43298iof0637h, and the server can analyze the abnormal information.
The specific manner of determining the abnormal information by the server may be any manner that can determine the abnormal information in the related art, and is not specifically limited and described herein.
As can be seen, in this embodiment, the electronic device may send the correspondence between the file content identification information of the second target file and the file name included in the download address of the second target file to the server. Furthermore, the server can determine the abnormal information of the second target file, and the abnormal problem of the second target file is solved more favorably.
As an implementation manner of the embodiment of the present invention, the step of downloading the second target file may include:
and downloading a second target file and downloading the original file name of the second target file.
For the situation that the electronic device uploading the second target file uploads the original file name while uploading the second target file, the electronic device downloads the second target file and also downloads the original file name of the second target file.
Correspondingly, after the step of determining that the second target file is a normal file, the method may further include:
and modifying the file name of the second target file into the original file name.
Therefore, after the electronic device determines that the second target file is a normal file, the electronic device can modify the file name of the second target file to be the original file name so that a user can know the original file name of the second target file and further know the file information which can be represented by the original file name.
For example, the original file name of the second target file is video m, the electronic device may modify the file name of the second target file to be video m, and then the user may know that the file is a file related to video m.
It can be seen that, in this embodiment, when the electronic device downloads the second target file, the electronic device may download the original file name of the second target file, and further modify the file name of the second target file to be the original file name. Therefore, the user can know the file information represented by the original file name of the second target file, the user can sort the downloaded file more conveniently, and the user experience is better.
First, a second file downloading method provided in the embodiment of the present invention is described below.
The second file downloading method provided in the embodiment of the present invention may also be applied to any electronic device that needs to download a file, for example, a mobile phone, a computer, a processor, and the like, which is not limited herein. To facilitate downloading of files from a predetermined database or server, the electronic device may be communicatively coupled to the predetermined database or server for data transfer.
As shown in fig. 3, a file downloading method includes:
s301, downloading a second target file;
s302, calculating file content identification information of the second target file;
s303, judging whether the file content identification information is matched with a file name contained in a download address of the second target file; if yes, go to step S304; if not, executing step S305;
s304, determining the second target file to be a normal file;
s305, determining the second target file to be an abnormal file;
s306, reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
It can be seen that, in the scheme provided in the embodiment of the present invention, after the electronic device downloads the second target file, the file content identification information of the second target file may be calculated, and then it is determined whether the file content identification information matches a file name included in a download address of the second target file, if so, the second target file is determined to be a normal file, and if not, the second target file is indicated to be an abnormal file, and then an abnormal message is reported to the server, where the abnormal message is a message that the second target file is an abnormal file. Therefore, after the electronic device downloads the second target file, whether the file content identification information is matched with the file name contained in the download address of the second target file can be judged, and the file name contained in the upload address can identify the content of the second target file, so that whether the second target file is tampered or replaced can be determined, the problem that the commercial secret or property safety of a user is threatened due to the fact that the file is tampered or replaced is avoided, and when the second target file is determined to be tampered or replaced, an abnormal message can be reported to the server, so that the server can perform corresponding processing.
Since steps S301 to S304 are the same as steps S201 to S204 in the first file downloading method, details are not repeated here, and the same points can be referred to the partial description of steps S201 to S204 in the first file downloading method.
In step S305, if the second target file is tampered or replaced within the period of time from the uploading to the downloading, the file content of the second target file downloaded by the electronic device has changed, and the calculated file content identification information does not match the file name included in the download address of the second target file, then the electronic device may determine that the second target file is an abnormal file.
Furthermore, in order to timely handle the problem that the second target file is tampered or replaced and avoid more files from being illegally tampered or replaced, the electronic device may report an exception message to the server, where the exception message is a message indicating that the second target file is an exception file. The server can know that the second target file is tampered or replaced after receiving the abnormal message, and further can perform corresponding processing, for example, the second target file can be deleted to avoid larger loss caused by the fact that the second target file is a malicious virus file and the like. It is reasonable that the second target file may also be parsed to find the reason why the second target file is tampered or replaced, and the method is not limited herein.
As an implementation manner of the embodiment of the present invention, in a case that the MD5 encrypted value of the file is used as the file content identification information when the file is uploaded, the step of calculating the file content identification information of the second target file may include:
and calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
As an implementation manner of the embodiment of the present invention, after the step of determining that the second target file is an abnormal file, the method may further include:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the method may further include:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the step of downloading the second target file may include:
downloading a second target file and downloading an original file name of the second target file;
after the step of determining that the second target file is a normal file, the method may further include:
and modifying the file name of the second target file into the original file name.
The embodiment is introduced in the first file downloading method, and may participate in the partial description of the first file downloading method, which is not described herein again.
An embodiment of a file uploading and downloading method provided by the embodiment of the invention is described below with reference to a specific application scenario. The application scenario is that a background system in the electronic device uploads a file to a storage warehouse of the website W, and a client downloads the file. The file content identification information is represented by an MD5 encrypted value of the file, the file uploading and downloading process is shown in fig. 4, CMS in fig. 4 represents a backend system, s3 represents a storage warehouse of a website W, the file address represents a downloading address, and MD5 represents an MD5 encrypted value of the file. The specific file uploading process is as follows:
the background system CMS starts to upload a file a.zip after acquiring the file, wherein a is a file name, and then calculates the MD5 encryption value of the file as: occ175b9c0f1b6a831c399e269772661, renaming the filename by using the MD5 encrypted value as: occ175b9c0f1b6a831c399e269772661. The background system CMS uploads the renamed file to the storage warehouse of the website W S3, S3 generates an upload address of the file: http:// www.test.com/buck/Occc175b9c0f1b6a831c399e269772661. zip, and returns the generated address to the background system CMS.
And then, the background system CMS issues the uploading address of the file to the client through a series of processes. When the client needs to download the file, the file is downloaded according to the address, the MD5 encryption value of the calculator is calculated, whether the calculated MD5 encryption value is consistent with the MD5 encryption value in the download address is further judged, if so, the client can determine that the file is a normal file and continue the logic processing of the client on the file. If the inconsistency indicates that the file is tampered or replaced, the client can report the file to the server, and the server can assist in finding the reason why the file is tampered or replaced and conduct corresponding processing to solve the problem.
It can be seen that, with the file uploading and downloading method shown in fig. 4, when the background system in the electronic device sends the file to the storage warehouse of the website W, the file may be renamed by using the MD5 encrypted value of the file, when the client downloads the file, it may be determined whether the MD5 encrypted value of the downloaded file is consistent with the MD5 encrypted value in the download address, thereby avoiding the problem that the user's business secret or property security is threatened due to the file being tampered or replaced, and in addition, in the case that the file is tampered or replaced, the relevant information of the server may also be reported, so that the server may find the reason for the file being tampered or replaced, and perform corresponding processing to solve the problem.
Corresponding to the file uploading method, the embodiment of the invention also provides a file uploading device.
The following describes a file uploading apparatus provided in an embodiment of the present invention.
As shown in fig. 5, a file uploading apparatus, the apparatus comprising:
an object file obtaining module 510, configured to obtain a first object file;
a first identification information determining module 520, configured to determine file content identification information of the first target file;
wherein the file content identification information is information identifying the content of the first target file.
A file name determining module 530, configured to determine, according to the file content identifier information, a file name corresponding to the first target file;
a renaming module 540, configured to rename the first target file by using the file name, and upload the renamed first target file.
As can be seen, in the scheme provided in the embodiment of the present invention, the electronic device obtains the first target file, then determines the file content identification information of the first target file, where the file content identification information is information identifying the content of the first target file, then determines the file name corresponding to the first target file according to the file content identification information, then renames the first target file by using the file name, and uploads the renamed first target file. Therefore, after the first target file is downloaded, whether the file content identification information is matched with the file name contained in the download address of the first target file can be judged, and if so, the first target file is determined to be a normal file. Since the file name contained in the uploading address can identify the content of the first target file, whether the first target file is tampered or replaced can be determined, and therefore the problem that the commercial secret or property security of a user is threatened due to the fact that the file is tampered or replaced is avoided.
As an implementation manner of the embodiment of the present invention, the first identification information determining module 520 may include:
a first identification information determining unit (not shown in fig. 5) for calculating the MD5 encrypted value of the first target file as the file content identification information of the first target file according to the information digest algorithm.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
an upload address obtaining module (not shown in fig. 5) configured to obtain, after the first renamed target file is uploaded, an upload address of the first renamed target file.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a file name obtaining module (not shown in fig. 5) configured to obtain an original file name of the renamed first target file before uploading the renamed first target file;
the renaming module 540 may include:
and a file name uploading unit (not shown in fig. 5) configured to upload the renamed first target file, and upload an original file name of the first target file.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a first recording module (not shown in fig. 5) configured to record a corresponding relationship between the first target file and the determined file name after determining the file name corresponding to the first target file according to the file content identification information.
As an implementation manner of the embodiment of the present invention, the first recording module may include:
a file name acquisition unit (not shown in fig. 5) for acquiring an original file name of the first target file;
a first recording unit (not shown in fig. 5) for recording a correspondence relationship between an original file name of the first target file and the determined file name.
Corresponding to the file downloading method, the embodiment of the invention also provides a file downloading device.
The following describes a file downloading device provided in an embodiment of the present invention.
As shown in fig. 6, a file downloading apparatus, the apparatus comprising:
an object file downloading module 610, configured to download a second object file;
a second identification information determining module 620, configured to calculate file content identification information of the second target file;
a judging module 630, configured to judge whether the file content identification information matches a file name included in the download address of the second target file;
a normal file determining module 640, configured to determine that the second target file is a normal file when the file content identification information matches a file name included in the download address of the second target file.
It can be seen that, in the scheme provided in the embodiment of the present invention, after the electronic device downloads the second target file, the file content identification information of the second target file may be calculated, and then it is determined whether the file content identification information matches with the file name included in the download address of the second target file, if so, it is determined that the second target file is a normal file, and if not, it is determined that the second target file is an abnormal file. Therefore, after the electronic equipment downloads the second target file, whether the file content identification information is matched with the file name contained in the download address of the second target file or not can be judged, and the file name contained in the upload address can identify the content of the second target file, so that whether the second target file is tampered or replaced or not can be determined, and the problem that the commercial secret or property safety of a user is threatened due to the fact that the file is tampered or replaced is avoided.
As an implementation manner of the embodiment of the present invention, the second identification information determining module 620 may include:
a second identification information determining unit (not shown in fig. 6) for calculating the MD5 encrypted value of the second target file according to the information digest algorithm as the file content identification information of the second target file.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
an abnormal file determining module (not shown in fig. 6), configured to determine that the second target file is an abnormal file when it is determined that the file content identification information does not match a file name included in the download address of the target file;
an exception message reporting module (not shown in fig. 6) configured to report an exception message to a server, where the exception message is a message indicating that the second target file is an exception file.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a second recording module (not shown in fig. 6), configured to record, after the second target file is determined to be an abnormal file, a correspondence between file content identification information of the second target file and a file name included in a download address of the second target file.
As an implementation manner of the embodiment of the present invention, the apparatus may further include:
a corresponding relationship sending module (not shown in fig. 6), configured to send a corresponding relationship between the file content identification information of the second target file and the file name included in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name included in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the target file downloading module 610 may include:
a file name downloading unit (not shown in fig. 6) for downloading a second object file and downloading an original file name of the second object file;
the above apparatus may further include:
a file name modifying module (not shown in fig. 6) configured to modify the file name of the second target file to be the original file name after the second target file is determined to be a normal file.
An embodiment of the present invention further provides an electronic device, as shown in fig. 7, the electronic device may include a first processor 701, a first communication interface 702, a first memory 703 and a first communication bus 704, where the first processor 701, the first communication interface 702 and the first memory 703 complete mutual communication through the first communication bus 704,
a first memory 703 for storing a computer program;
the first processor 701 is configured to implement the following steps when executing the program stored in the first memory 703:
acquiring a first target file;
determining file content identification information of the first target file;
wherein the file content identification information is information identifying the content of the first target file.
Determining a file name corresponding to the first target file according to the file content identification information;
and renaming the first target file by using the file name, and uploading the renamed first target file.
As can be seen, in the scheme provided in the embodiment of the present invention, the electronic device obtains the first target file, then determines the file content identification information of the first target file, where the file content identification information is information identifying the content of the first target file, then determines the file name corresponding to the first target file according to the file content identification information, then renames the first target file by using the file name, and uploads the renamed first target file. Therefore, after the first target file is downloaded, whether the file content identification information is matched with the file name contained in the download address of the first target file can be judged, and if so, the first target file is determined to be a normal file. Since the file name contained in the uploading address can identify the content of the first target file, whether the first target file is tampered or replaced can be determined, and therefore the problem that the commercial secret or property security of a user is threatened due to the fact that the file is tampered or replaced is avoided.
The first communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The first communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The first communication interface is used for communication between the electronic equipment and other equipment.
The first Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the first memory may also be at least one memory device located remotely from the processor.
The first Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also 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.
As an implementation manner of the embodiment of the present invention, the step of determining the file content identification information of the first target file may include:
and calculating the MD5 encrypted value of the first target file according to an information digest algorithm to serve as the file content identification information of the first target file.
As an implementation manner of the embodiment of the present invention, after the step of uploading the renamed first target file, the method may further include:
and acquiring the uploading address of the renamed first target file.
As an implementation manner of the embodiment of the present invention, before the step of uploading the renamed first target file, the method may further include:
acquiring an original file name of the first target file;
the step of uploading the renamed first target file comprises:
and uploading the renamed first target file, and uploading an original file name of the first target file.
As an implementation manner of the embodiment of the present invention, after the step of determining the file name corresponding to the first target file according to the file content identification information, the method may further include:
and recording the corresponding relation between the first target file and the determined file name.
As an implementation manner of the embodiment of the present invention, the step of recording the correspondence between the first target file and the determined file name may include:
acquiring an original file name of the first target file;
and recording the corresponding relation between the original file name of the first target file and the determined file name.
As shown in fig. 8, the electronic device may include a second processor 801, a second communication interface 802, a second memory 803, and a second communication bus 804, where the processor 801, the second communication interface 802, and the second memory 803 complete communication with each other through the second communication bus 804,
a second memory 803 for storing a computer program;
the second processor 801 is configured to, when executing the program stored in the second memory 803, implement the following steps:
downloading a second target file;
calculating file content identification information of the second target file;
judging whether the file content identification information is matched with a file name contained in a download address of the second target file;
if so, determining that the second target file is a normal file.
It can be seen that, in the scheme provided in the embodiment of the present invention, after the electronic device downloads the second target file, the file content identification information of the second target file may be calculated, and then it is determined whether the file content identification information matches with the file name included in the download address of the second target file, if so, it is determined that the second target file is a normal file, and if not, it is determined that the second target file is an abnormal file. Therefore, after the electronic equipment downloads the second target file, whether the file content identification information is matched with the file name contained in the download address of the second target file or not can be judged, and the file name contained in the upload address can identify the content of the second target file, so that whether the second target file is tampered or replaced or not can be determined, and the problem that the commercial secret or property safety of a user is threatened due to the fact that the file is tampered or replaced is avoided.
The second communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The second communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The second communication interface is used for communication between the electronic equipment and other equipment.
The second Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the second memory may also be at least one memory device located remotely from the processor.
The second Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also 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.
As an implementation manner of the embodiment of the present invention, the step of calculating the file content identification information of the second target file may include:
and calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
As an implementation manner of the embodiment of the present invention, when it is determined that the file content identification information does not match a file name included in the download address of the target file, the method may further include:
determining that the second target file is an abnormal file;
and reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
As an implementation manner of the embodiment of the present invention, after the step of determining that the second target file is an abnormal file, the method may further include:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the method may further include:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the step of downloading the second target file may include:
downloading a second target file and downloading an original file name of the second target file;
after the step of determining that the second target file is a normal file, the method may further include:
and modifying the file name of the second target file into the original file name.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when executed by a processor, the computer program implements the following steps:
acquiring a first target file;
determining file content identification information of the first target file;
wherein the file content identification information is information identifying the content of the first target file.
Determining a file name corresponding to the first target file according to the file content identification information;
and renaming the first target file by using the file name, and uploading the renamed first target file.
As can be seen, in the solution provided in the embodiment of the present invention, when the computer program is executed by the processor, the first target file is obtained, the file content identification information of the first target file is determined, where the file content identification information is information identifying the content of the first target file, the file name corresponding to the first target file is determined according to the file content identification information, the first target file is renamed by using the file name, and the renamed first target file is uploaded. Therefore, after the first target file is downloaded, whether the file content identification information is matched with the file name contained in the download address of the first target file can be judged, and if so, the first target file is determined to be a normal file. Since the file name contained in the uploading address can identify the content of the first target file, whether the first target file is tampered or replaced can be determined, and therefore the problem that the commercial secret or property security of a user is threatened due to the fact that the file is tampered or replaced is avoided.
As an implementation manner of the embodiment of the present invention, the step of determining the file content identification information of the first target file may include:
and calculating the MD5 encrypted value of the first target file according to an information digest algorithm to serve as the file content identification information of the first target file.
As an implementation manner of the embodiment of the present invention, after the step of uploading the renamed first target file, the method may further include:
and acquiring the uploading address of the renamed first target file.
As an implementation manner of the embodiment of the present invention, before the step of uploading the renamed first target file, the method may further include:
acquiring an original file name of the first target file;
the step of uploading the renamed first target file comprises:
and uploading the renamed first target file, and uploading an original file name of the first target file.
As an implementation manner of the embodiment of the present invention, after the step of determining the file name corresponding to the first target file according to the file content identification information, the method may further include:
and recording the corresponding relation between the first target file and the determined file name.
As an implementation manner of the embodiment of the present invention, the step of recording the correspondence between the first target file and the determined file name may include:
acquiring an original file name of the first target file;
and recording the corresponding relation between the original file name of the first target file and the determined file name.
An embodiment of the present invention further provides another computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the following steps:
downloading a second target file;
calculating file content identification information of the second target file;
judging whether the file content identification information is matched with a file name contained in a download address of the second target file;
if so, determining that the second target file is a normal file.
It can be seen that, in the solution provided in the embodiment of the present invention, when the computer program is executed by the processor, the file content identification information of the second target file may be calculated after the second target file is downloaded, and then it is determined whether the file content identification information matches with the file name included in the download address of the second target file, if so, it is determined that the second target file is a normal file, and if not, it indicates that the second target file is an abnormal file. Therefore, after the electronic equipment downloads the second target file, whether the file content identification information is matched with the file name contained in the download address of the second target file or not can be judged, and the file name contained in the upload address can identify the content of the second target file, so that whether the second target file is tampered or replaced or not can be determined, and the problem that the commercial secret or property safety of a user is threatened due to the fact that the file is tampered or replaced is avoided.
As an implementation manner of the embodiment of the present invention, the step of calculating the file content identification information of the second target file may include:
and calculating the MD5 encrypted value of the second target file according to an information digest algorithm to serve as the file content identification information of the second target file.
As an implementation manner of the embodiment of the present invention, when it is determined that the file content identification information does not match a file name included in the download address of the target file, the method may further include:
determining that the second target file is an abnormal file;
and reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
As an implementation manner of the embodiment of the present invention, after the step of determining that the second target file is an abnormal file, the method may further include:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the method may further include:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
As an implementation manner of the embodiment of the present invention, the step of downloading the second target file may include:
downloading a second target file and downloading an original file name of the second target file;
after the step of determining that the second target file is a normal file, the method may further include:
and modifying the file name of the second target file into the original file name.
It should be noted that, for the above-mentioned apparatus, electronic device and computer-readable storage medium embodiments, since they are substantially similar to the corresponding method embodiments, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiments.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (24)

1. A file uploading method, the method comprising:
acquiring a first target file;
calculating the MD5 encrypted value of the first target file according to an information digest algorithm, wherein the MD5 encrypted value serves as file content identification information of the first target file;
determining a file name corresponding to the first target file according to the file content identification information;
renaming the first target file by using the file name, and uploading the renamed first target file, wherein the file name included in the uploading address corresponding to the renamed first target file is the file name adopted in renaming.
2. The method of claim 1, wherein after the step of uploading the renamed first target file, the method further comprises:
and acquiring the uploading address of the renamed first target file.
3. The method of claim 1, wherein prior to the step of uploading the renamed first target file, the method further comprises:
acquiring an original file name of the first target file;
the step of uploading the renamed first target file comprises:
and uploading the renamed first target file, and uploading an original file name of the first target file.
4. The method according to claim 1, wherein after the step of determining the file name corresponding to the first target file according to the file content identification information, the method further comprises:
and recording the corresponding relation between the first target file and the determined file name.
5. The method of claim 4, wherein the step of recording the correspondence of the first target file to the determined file name comprises:
acquiring an original file name of the first target file;
and recording the corresponding relation between the original file name of the first target file and the determined file name.
6. A method for downloading a file, the method comprising:
downloading a second target file;
calculating the MD5 encrypted value of the second target file according to an information digest algorithm, wherein the MD5 encrypted value serves as file content identification information of the second target file;
judging whether the file content identification information is matched with a file name contained in a download address of the second target file, wherein the file name contained in the download address of the second target file is a file name renamed according to the file content identification information of the second target file when the second target file is uploaded;
if so, determining that the second target file is a normal file.
7. The method according to claim 6, wherein when it is judged that the file content identification information does not match a file name contained in the download address of the second target file, the method further comprises:
determining that the second target file is an abnormal file;
and reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
8. The method of claim 7, wherein after the step of determining that the second target file is an anomalous file, the method further comprises:
and recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file.
9. The method of claim 8, wherein the method further comprises:
and sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server, so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
10. The method of claim 6, wherein said step of downloading a second object file comprises:
downloading a second target file and downloading an original file name of the second target file;
after the step of determining that the second target file is a normal file, the method further comprises:
and modifying the file name of the second target file into the original file name.
11. An apparatus for uploading a document, the apparatus comprising:
the target file acquisition module is used for acquiring a first target file;
the first identification information determining module is used for calculating the MD5 encrypted value of the first target file according to an information digest algorithm, and the MD5 encrypted value serves as the file content identification information of the first target file;
the file name determining module is used for determining a file name corresponding to the first target file according to the file content identification information;
and the renaming module is used for renaming the first target file by using the file name and uploading the renamed first target file, wherein the file name in the uploading address corresponding to the renamed first target file is the file name adopted in renaming.
12. The apparatus of claim 11, wherein the apparatus further comprises:
and the uploading address acquisition module is used for acquiring the uploading address of the renamed first target file after the renamed first target file is uploaded.
13. The apparatus of claim 11, wherein the apparatus further comprises:
the file name acquisition module is used for acquiring the original file name of the first target file before uploading the renamed first target file;
the renaming module comprises:
and the file name uploading unit is used for uploading the renamed first target file and uploading the original file name of the first target file.
14. The apparatus of claim 11, wherein the apparatus further comprises:
and the first recording module is used for recording the corresponding relation between the first target file and the determined file name after the file name corresponding to the first target file is determined according to the file content identification information.
15. The apparatus of claim 14, wherein the first recording module comprises:
a file name acquisition unit, configured to acquire an original file name of the first target file;
and the first recording unit is used for recording the corresponding relation between the original file name of the first target file and the determined file name.
16. A file download apparatus, characterized in that the apparatus comprises:
the target file downloading module is used for downloading a second target file;
the second identification information determining module is used for calculating the MD5 encrypted value of the second target file according to an information digest algorithm, and the MD5 encrypted value serves as the file content identification information of the second target file;
the judging module is used for judging whether the file content identification information is matched with a file name contained in a download address of the second target file, wherein the file name contained in the download address of the second target file is a file name renamed according to the file content identification information of the second target file when the second target file is uploaded;
and the normal file determining module is used for determining that the second target file is a normal file when the file content identification information is matched with the file name contained in the download address of the second target file.
17. The apparatus of claim 16, wherein the apparatus further comprises:
the abnormal file determining module is used for determining the second target file as an abnormal file when judging that the file content identification information is not matched with the file name contained in the download address of the target file;
and the abnormal message reporting module is used for reporting an abnormal message to a server, wherein the abnormal message is a message indicating that the second target file is an abnormal file.
18. The apparatus of claim 17, wherein the apparatus further comprises:
and the second recording module is used for recording the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file after the second target file is determined to be the abnormal file.
19. The apparatus of claim 18, wherein the apparatus further comprises:
and the corresponding relation sending module is used for sending the corresponding relation between the file content identification information of the second target file and the file name contained in the download address of the second target file to the server so that the server determines the abnormal information of the second target file according to the file content identification information of the second target file and the file name contained in the download address of the second target file.
20. The apparatus of claim 16, wherein the target file download module comprises:
the file name downloading unit is used for downloading a second target file and downloading the original file name of the second target file;
the device further comprises:
and the file name modifying module is used for modifying the file name of the second target file into the original file name after the second target file is determined to be the normal file.
21. An electronic device is characterized by comprising a first processor, a first communication interface, a first memory and a first communication bus, wherein the first processor, the first communication interface and the first memory are used for completing communication with each other through the first communication bus;
a first memory for storing a computer program;
a first processor arranged to implement the method steps of any of claims 1 to 5 when executing the program stored in the first memory.
22. An electronic device is characterized by comprising a second processor, a second communication interface, a second memory and a second communication bus, wherein the second processor, the second communication interface and the second memory are communicated with each other through the second communication bus;
a second memory for storing a computer program;
a second processor arranged to perform the method steps of any of claims 6 to 10 when executing the program stored in the second memory.
23. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-5.
24. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 6-10.
CN201811158068.7A 2018-09-30 2018-09-30 File uploading and downloading method and device, electronic equipment and storage medium Active CN109598131B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811158068.7A CN109598131B (en) 2018-09-30 2018-09-30 File uploading and downloading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811158068.7A CN109598131B (en) 2018-09-30 2018-09-30 File uploading and downloading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN109598131A CN109598131A (en) 2019-04-09
CN109598131B true CN109598131B (en) 2021-07-30

Family

ID=65958388

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811158068.7A Active CN109598131B (en) 2018-09-30 2018-09-30 File uploading and downloading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109598131B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110058858B (en) * 2019-04-19 2023-05-02 东信和平科技股份有限公司 JSON data processing method and device
CN110688672A (en) * 2019-09-17 2020-01-14 上海易点时空网络有限公司 Method and system for ensuring file downloading safety of data warehouse
CN110647766A (en) * 2019-09-19 2020-01-03 上海易点时空网络有限公司 Method and system for ensuring file downloading safety of data warehouse
CN113497787B (en) * 2020-03-20 2022-12-13 阿里巴巴集团控股有限公司 File transmission method, equipment and system
CN112835529A (en) * 2021-02-23 2021-05-25 深圳市得一微电子有限责任公司 Data storage method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102780728A (en) * 2011-05-13 2012-11-14 腾讯科技(深圳)有限公司 Media file transcoding and downloading method and client
CN103078881A (en) * 2011-10-26 2013-05-01 腾讯科技(深圳)有限公司 Sharing control system and method for network resource downloading information
KR20130092737A (en) * 2012-02-13 2013-08-21 서울대학교산학협력단 Method, system and computer-readable recording medium for searching position of metadata
CN105426766A (en) * 2015-10-27 2016-03-23 武汉理工大学 File encryption system based on shadow file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102780728A (en) * 2011-05-13 2012-11-14 腾讯科技(深圳)有限公司 Media file transcoding and downloading method and client
CN103078881A (en) * 2011-10-26 2013-05-01 腾讯科技(深圳)有限公司 Sharing control system and method for network resource downloading information
KR20130092737A (en) * 2012-02-13 2013-08-21 서울대학교산학협력단 Method, system and computer-readable recording medium for searching position of metadata
CN105426766A (en) * 2015-10-27 2016-03-23 武汉理工大学 File encryption system based on shadow file

Also Published As

Publication number Publication date
CN109598131A (en) 2019-04-09

Similar Documents

Publication Publication Date Title
CN109598131B (en) File uploading and downloading method and device, electronic equipment and storage medium
CN107391298B (en) Data storage state detection method and device and computer readable storage medium
CN107729352B (en) Page resource loading method and terminal equipment
CN110428255B (en) Vehicle data management method and device based on block chain
CN111314306A (en) Interface access method and device, electronic equipment and storage medium
CN107426173B (en) File protection method and device
US11438358B2 (en) Aggregating asset vulnerabilities
CN103139761B (en) The method and communication terminal of a kind of information real-time show
CN110516471B (en) Product promotion method based on information security and related equipment
CN113489713A (en) Network attack detection method, device, equipment and storage medium
CN109885790B (en) Method and device for acquiring satisfaction evaluation data
CN110008719B (en) File processing method and device, and file detection method and device
CN107656742A (en) A kind of software product dissemination method and device
US9973625B1 (en) System to share and present temporary contact information
CN111598681A (en) Credit evaluation method, credit evaluation system and readable storage medium
CN110958239A (en) Method and device for verifying access request, storage medium and electronic device
US11210404B2 (en) Blockchain-based state verifications of software component vulnerability database for software products
CN110826091A (en) File signature method and device, electronic equipment and readable storage medium
CN107181801B (en) Electronic accessory storage method and terminal
CN111445250B (en) Block chain key testing method and device
EP3742367A1 (en) Method for determining information integrity and computer system using the same
CN116150711A (en) Software processing method and device, electronic equipment and storage medium
CN109785129B (en) Data acquisition method, device, equipment and computer readable storage medium
CN109635164B (en) Number detection method and device
CN110647766A (en) Method and system for ensuring file downloading safety of data warehouse

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190606

Address after: Room A-3010, 2nd floor, No. 3 Courtyard, 30 Shixing Street, Shijingshan District, Beijing

Applicant after: Beijing happy I unlimited Technology Co., Ltd.

Address before: Kamana Bay

Applicant before: Happy honey Company Limited

GR01 Patent grant
GR01 Patent grant