Disclosure of Invention
In order to solve the above technical problems, the present invention provides a method and an apparatus for acquiring a file, which can record a download history of the file, so that when the file is illegally stolen, a user who has downloaded the file can be acquired through recording, thereby reducing the scope of the pirate to a great extent.
In order to achieve the object of the present invention, the present invention provides a file acquisition method, including:
receiving a downloading request aiming at a target file sent by a first user;
acquiring a target file from a file storage space according to the downloading request;
acquiring identification information of the target file and user information of the first user; the identification information of the target file is information which uniquely identifies the target file;
sending the target file to the first user;
and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database.
After the obtaining of the identification information of the target file and the user information of the first user, the method further includes:
acquiring the moment when the downloading request is received;
correspondingly, the generating a download record according to the identification information of the target file and the user information of the first user, and storing the download record in a preset database includes:
and generating a file downloading record according to the identification information of the target file, the user information of the first user and the moment of receiving the downloading request, and storing the file downloading record in the preset database.
The sending the target file to the first user includes:
judging whether the first user is a legal user or not;
and if the first user is determined to be a legal user, sending the target file to the first user.
The judging whether the first user is a legal user comprises the following steps:
calculating the identification information of the target file and the user information of the first user by adopting a preset algorithm and generating a verification code;
sending the verification code to the first user in a contact way reserved by the first user;
receiving a verification code input by the first user;
judging whether the verification code input by the first user is consistent with the verification code generated by calculating the identification information of the target file and the user information of the first user by adopting the pre-algorithm;
and if so, determining that the first user is a legal user.
The invention also provides a file acquisition device, comprising:
the receiving module is used for receiving a downloading request aiming at a target file sent by a first user;
the acquisition module is used for acquiring a target file from the file storage space according to the downloading request; acquiring identification information of the target file and user information of the first user; the identification information of the target file is information which uniquely identifies the target file;
a sending module, configured to send the target file to the first user;
and the processing module is used for generating a file downloading record according to the identification information of the target file and the user information of the first user and storing the file downloading record in a preset database.
The acquisition module is further configured to acquire a time when the download request is received;
the processing module is specifically configured to generate a file download record according to the identification information of the target file, the user information of the first user, and the time when the download request is received, and store the file download record in a preset database.
Before receiving a download request for a target file sent by a first user, the method further includes:
receiving a file uploading request containing a file to be uploaded sent by a second user;
storing the file to be uploaded in the file storage space;
acquiring identification information of the file to be uploaded and user information of the second user; the identification information of the file to be uploaded is the information which uniquely identifies the file to be uploaded;
and generating a file uploading record according to the identification information of the file to be uploaded and the user information of the second user, and storing the file uploading record in the preset database.
The sending module comprises:
the judging unit is used for judging whether the first user is a legal user or not;
and the sending unit is used for sending the target file to the first user if the first user is determined to be a legal user.
The judgment unit is specifically configured to:
calculating the identification information of the target file and the user information of the first user by adopting a preset algorithm and generating a verification code;
sending the verification code to the first user;
receiving a verification code input by the first user;
judging whether the verification code input by the first user is consistent with the verification code generated by calculating the identification information of the target file and the user information of the first user by adopting the pre-algorithm;
and if so, determining that the first user is a legal user.
The receiving module is further used for receiving a file uploading request containing a file to be uploaded, which is sent by a second user;
the acquisition module is further configured to acquire identification information of the file to be uploaded and user information of the second user; the identification information of the file to be uploaded is the information which uniquely identifies the file to be uploaded;
the processing module is further configured to store the file to be uploaded in the file storage space;
and generating a file uploading record according to the identification information of the file to be uploaded and the user information of the second user, and storing the file uploading record in the preset database.
Compared with the prior art, the method at least comprises the steps of receiving a downloading request aiming at the target file sent by a first user; acquiring a target file from a file storage space according to a downloading request; acquiring identification information of a target file and user information of a first user; sending a target file to a first user; and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database. According to the technical scheme provided by the invention, when a downloading request aiming at the target file sent by the first user is received, the user information of the first user is obtained, and the file downloading record is generated according to the identification information of the target file and the user information of the first user, so that the downloading record realizes the binding of the user and the downloaded file, and the user who downloads the file can be obtained through the record when the downloaded file is stolen by others, thereby greatly reducing the range of thieves.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
An embodiment of the present invention provides a file acquisition method, as shown in fig. 1, the method includes:
step 101, receiving a downloading request for a target file sent by a first user.
It should be noted that the first user is a user who sends a download request for the target file, and is distinguished from a user who uploads the file.
Specifically, the number of the object files may be one or more, and the present invention is not limited thereto.
And 102, acquiring a target file from the file storage space according to the downloading request.
Specifically, since the user needs to send the target file first, the target file needs to be obtained from the file storage space storing all files according to the download request.
And 103, acquiring the identification information of the target file and the user information of the first user.
The identification information of the target file is the only information capable of identifying the target file.
Specifically, the identification information may be a check code obtained by checking the target file through a Message Digest fifth version (MD 5) Algorithm; the identification information of the target file may also be the file name of the target file if the file names of each file are different.
It should be noted that the user information is related information that is filled in by the user at the time of registration, and the user information may include a user name of the user, a contact address of the user, and the like, where the contact address of the user may include a telephone contact address and an email contact address, and therefore the user information is unique.
Specifically, the user needs to register before sending a download request for the target file, and during the registration, the user fills in information such as a user name, a contact information of the user, and a login password, and the information is stored in the system, wherein the login password set by the user is stored in a form of a ciphertext for security. After the user finishes registering and before the file is required to be downloaded, the user can log in the system according to the registered user name and the set login password, after the user logs in the system, the user sends a downloading request aiming at the target file, and because the request is sent on the name of the user, the system can obtain the user information of the user according to the stored information after receiving the downloading request.
And 104, sending the target file to the first user.
And 105, generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database.
Specifically, because the identification information of the target file and the user information of the first user are unique, the download record realizes the binding between the first user and the downloaded file.
The file acquisition method provided by the invention receives a downloading request aiming at a target file sent by a first user; acquiring a target file from a file storage space according to a downloading request; acquiring identification information of a target file and user information of a first user; sending a target file to a first user; and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database. According to the technical scheme provided by the invention, when a downloading request aiming at the target file sent by the first user is received, the user information of the first user is obtained, and the file downloading record is generated according to the identification information of the target file and the user information of the first user, so that the downloading record realizes the binding of the user and the downloaded file, and the user who downloads the file can be obtained through the record when the downloaded file is stolen by others, thereby greatly reducing the range of thieves.
An embodiment of the present invention provides another file acquisition method, as shown in fig. 2, the method includes:
step 201, receiving a downloading request for a target file sent by a first user.
Step 202, obtaining the target file from the file storage space according to the downloading request.
Step 203, acquiring the identification information of the target file and the user information of the first user.
The identification information of the target file is the only information capable of identifying the target file.
And step 204, acquiring the time when the downloading request is received.
Specifically, the time when the download request is received includes year, month, day, hour, minute, and may also include second.
It should be noted that, since the communication speed is extremely fast, the time when the download request is transmitted is very close to the time when the download request is received and the time when the target file is received by the user, the time when the target file is downloaded by the user is represented by the time when the download request transmitted by the user is received.
Step 205, determine whether the first user is a valid user.
And step 206, if the first user is determined to be a legal user, sending the target file to the first user.
It should be noted that, if it is determined that the first user is not a legal user, the target file is not sent to the first user.
And step 207, generating a file downloading record according to the identification information of the target file, the user information of the first user and the time when the downloading request is received, and storing the file downloading record in a preset database.
Specifically, the time when the download request is received is added to the download record, so that the binding between the user and the downloaded file and the download time of the user is realized.
It should be noted that, for the explanation of the same steps or concepts in the present embodiment as in the other embodiments, reference may be made to the description in the other embodiments.
The file acquisition method provided by the invention receives a downloading request aiming at a target file sent by a first user; acquiring a target file from a file storage space according to a downloading request; acquiring identification information of a target file and user information of a first user; sending a target file to a first user; and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database. According to the technical scheme provided by the invention, when a downloading request aiming at the target file sent by the first user is received, the user information of the first user is obtained, and the file downloading record is generated according to the identification information of the target file and the user information of the first user, so that the downloading record realizes the binding of the user and the downloaded file, and the user who downloads the file can be obtained through the record when the downloaded file is stolen by others, thereby greatly reducing the range of thieves.
An embodiment of the present invention provides another file obtaining method, as shown in fig. 3, the method includes:
step 301, receiving a file uploading request containing a file to be uploaded sent by a second user.
It should be noted that the second user is a user who sends a file upload request containing a file to be uploaded, and is different from the user who downloads the file.
Step 302, storing the file to be uploaded in a file storage space.
And step 303, acquiring the identification information of the file to be uploaded and the user information of the second user.
The identification information of the file to be uploaded is the only information capable of identifying the file to be uploaded.
Specifically, a user needs to register before sending a file uploading request containing a file to be uploaded, the user fills in information such as a user name, a contact way of the user, a login password and the like during registration, the information is stored in the system, and the login password set by the user is stored in a form of a ciphertext for safety. After the user finishes registering and before the file is required to be uploaded, the user can log in the system according to the registered user name and the set login password, after the user logs in the system, the user sends a file uploading request containing the file to be uploaded, and because the request is sent in the name of the user, the system can obtain the user information of the user according to the stored information after receiving the uploading request.
And 304, generating a file uploading record according to the identification information of the file to be uploaded and the user information of the second user, and storing the file uploading record in a preset database.
Specifically, the identification information of the file to be uploaded and the user information of the second user are unique, so that the second user and the file uploaded by the second user are bound.
Step 305, receiving a downloading request for a target file sent by a first user.
And step 306, acquiring the target file from the file storage space according to the downloading request.
And 307, acquiring the identification information of the target file and the user information of the first user.
The identification information of the target file is the only information capable of identifying the target file.
Step 308, obtaining the time when the download request is received.
Step 309, calculating the identification information of the target file and the user information of the first user by adopting a preset algorithm, and generating a verification code.
Step 310, sending the verification code to the first user in the contact way reserved by the first user.
It should be noted that the purpose of sending the verification code to the first user is to dynamically verify the identity of the first user, and prevent others from stealing the identity of the first user to download the file.
Step 311, receiving a verification code input by a first user.
And step 312, judging whether the verification code input by the first user is consistent with the verification code generated by calculating the identification information of the target file and the user information of the first user by adopting a pre-algorithm.
And 313, if the first user is consistent with the second user, determining that the first user is a legal user.
Step 314, sending the target file to the first user.
It should be noted that even if the first user requests to download the target file after logging in successfully, the system will not send the target file to the first user if the subsequent legal user identity fails.
And 315, generating a file downloading record according to the identification information of the target file, the user information of the first user and the time when the downloading request is received, and storing the file downloading record in a preset database.
Specifically, the time when the download request is received is added to the download record, so that the binding between the user and the downloaded file and the download time of the user is realized.
It should be noted that, for the explanation of the same steps or concepts in the present embodiment as in the other embodiments, reference may be made to the description in the other embodiments.
The file acquisition method provided by the invention receives a downloading request aiming at a target file sent by a first user; acquiring a target file from a file storage space according to a downloading request; acquiring identification information of a target file and user information of a first user; sending a target file to a first user; and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database. According to the technical scheme provided by the invention, when a downloading request aiming at the target file sent by the first user is received, the user information of the first user is obtained, and the file downloading record is generated according to the identification information of the target file and the user information of the first user, so that the downloading record realizes the binding of the user and the downloaded file, and the user who downloads the file can be obtained through the record when the downloaded file is stolen by others, thereby greatly reducing the range of thieves.
An embodiment of the present invention provides an apparatus for acquiring a file, as shown in fig. 4, where the apparatus 4 includes:
the receiving module 41 is configured to receive a download request for a target file sent by a first user.
An obtaining module 42, configured to obtain a target file from a file storage space according to a download request; acquiring identification information of a target file and user information of the first user; the identification information of the target file is information for uniquely identifying the target file.
A sending module 43, configured to send the target file to the first user.
And the processing module 44 is configured to generate a file download record according to the identification information of the target file and the user information of the first user, and store the file download record in a preset database.
Further, the obtaining module 42 is further configured to obtain a time when the download request is received.
The processing module 44 is specifically configured to generate a file download record according to the identification information of the target file, the user information of the first user, and the time when the download request is received, and store the file download record in a preset database.
Further, on the basis of the embodiment corresponding to fig. 4, an embodiment of the present invention provides another file obtaining apparatus, as shown in fig. 5, the sending module 43 includes:
the determining unit 431 is configured to determine whether the first user is a valid user.
A sending unit 432, configured to send the target file to the first user if it is determined that the first user is a legal user.
The determining unit 431 is specifically configured to:
and calculating the identification information of the target file and the user information of the first user by adopting a preset algorithm and generating the verification code.
The verification code is sent to the first user.
A verification code input by a first user is received.
And judging whether the verification code input by the first user is consistent with the verification code generated by calculating the identification information of the target file and the user information of the first user by adopting a pre-algorithm.
And if so, determining that the first user is a legal user.
Further, the receiving module 41 is further configured to receive a file upload request that includes a file to be uploaded and is sent by a second user.
The obtaining module 42 is further configured to obtain identification information of the file to be uploaded and user information of the second user; the identification information of the file to be uploaded is the information which uniquely identifies the file to be uploaded.
The processing module 44 is further configured to store the file to be uploaded in the file storage space; and generating a file uploading record according to the identification information of the file to be uploaded and the user information of the second user.
The file acquisition device provided by the invention receives a downloading request aiming at a target file sent by a first user; acquiring a target file from a file storage space according to a downloading request; acquiring identification information of a target file and user information of a first user; sending a target file to a first user; and generating a file downloading record according to the identification information of the target file and the user information of the first user, and storing the file downloading record in a preset database. According to the technical scheme provided by the invention, when a downloading request aiming at the target file sent by the first user is received, the user information of the first user is obtained, and the file downloading record is generated according to the identification information of the target file and the user information of the first user, so that the downloading record realizes the binding of the user and the downloaded file, and the user who downloads the file can be obtained through the record when the downloaded file is stolen by others, thereby greatly reducing the range of thieves.
In practical applications, the receiving module 41, the obtaining module 42, the sending module 43, the determining Unit 431, the sending Unit 432, and the processing module 44 may be implemented by a Central Processing Unit (CPU), a microprocessor Unit (MPU), a Digital Signal Processor (DSP), a Field Programmable Gate Array (FPGA), or the like, which is located in a file obtaining device.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.