File transmission method and device, equipment and storage medium
By introducing a browser-independent upload component and FTP protocol into the file transfer system, the problem of file transfer interruption caused by browser status interference is solved, the transfer efficiency and stability are improved, and large file fragmented transfer and breakpoint continuation are realized. pass.
Patent Information
- Application Number
- CN202410673073.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the existing technology, the browser-based file transfer function is easily interfered by the browser status, resulting in interruption of the transfer process and low efficiency.
By introducing a browser-independent upload component into the file transfer system, a transfer task is created after receiving file upload instructions, and the files are transferred to the target server based on the task sequence, and the FTP protocol is used for data communication to improve efficiency.
It realizes that the file transfer process is not disturbed by the browser status, improves the transmission efficiency and stability, and supports large file fragmented transfer, concurrent upload, breakpoint resume and real-time progress feedback.
Smart Images

Figure CN118590480A
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of file transmission technology, and in particular to a file transmission method, device, equipment and storage medium. Background Art
[0002] With the development of Internet technology, network transmission has become an indispensable part of modern society. Whether it is text, images, audio, video or other types of data, the corresponding transmission protocols are also constantly developing and updating. When the existing technology performs file transfer based on the browser, it usually performs file transfer based on the transmission function in the browser, which easily causes the file transfer process to be easily interfered by the browser. For example, if the browser is closed during the transmission process, the transmission task will be interrupted, resulting in abnormal suspension of the upload. To continue uploading, the file needs to be re-checked for upload, and the file transfer efficiency needs to be improved. Summary of the invention
[0003] The embodiments of the present invention provide a file transmission method, apparatus, device and storage medium, which can perform file transmission based on an upload component independent of a browser. The file transmission process is no longer affected by the browser status, thereby improving the file transmission efficiency.
[0004] In a first aspect, an embodiment of the present invention provides a file transmission method, which is applied to a file transmission system, wherein the file transmission system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication, and the file transmission method includes:
[0005] When the upload component receives a file upload instruction sent by the browser, the upload component creates a file transfer task according to the file upload instruction;
[0006] The upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
[0007] In a second aspect, an embodiment of the present invention provides a file transmission device, characterized in that it is applied to a file transmission system, the file transmission system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication, and the device includes:
[0008] A transmission task creation module, used for the upload component to create a file transmission task according to the file upload instruction when receiving the file upload instruction sent by the browser;
[0009] The file transfer module is used for the upload component to transfer the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transfer task.
[0010] In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising:
[0011] one or more processors;
[0012] A memory for storing one or more programs;
[0013] When the one or more programs are executed by the one or more processors, the one or more processors implement the file transmission method described in any embodiment.
[0014] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the file transfer method described in any embodiment.
[0015] The technical solution provided by the embodiment of the present invention is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication. When the upload component receives a file upload instruction sent by the browser, it creates a file transfer task according to the file upload instruction; based on the task transmission order in the file transfer task, the upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the upload component of the target server. The technical solution of the embodiment of the present invention solves the problem that the existing file transfer technology is mostly based on the transmission function in the browser to perform file transfer, which makes the file transfer process easily interfered by the browser status. The file transfer can be performed based on an upload component that is independent of the browser, and the file transfer process is no longer interfered by the browser status, thereby improving the file transfer efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 It is a flow chart of a file transmission method provided by an embodiment of the present invention;
[0017] Figure 2 is a flow chart of another file transmission method provided by an embodiment of the present invention;
[0018] Figure 3 This is a workflow diagram for performing file transfer provided by an embodiment of the present invention;
[0019] Figure 4 This is another workflow diagram for performing file transfer provided by an embodiment of the present invention;
[0020] Figure 5 It is a structural schematic diagram of a file transmission device provided by an embodiment of the present invention;
[0021] Figure 6 It is a structural schematic diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] Figure 1 It is a flow chart of a file transfer method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to a scenario in which a file corresponding to a transfer instruction sent by a browser is transferred to a server. The method is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication. The method can be executed by a file transfer device, which can be implemented by software and / or hardware.
[0024] like Figure 1 As shown, the file transfer method includes the following steps:
[0025] S110. When the upload component receives a file upload instruction sent by a browser, the upload component creates a file transfer task according to the file upload instruction.
[0026] Among them, the upload component can be a component for uploading files to the corresponding server. The upload component can be a component independent of the browser. By making the upload component independent of the browser, the file transfer task of the upload component can be unaffected by the browser state, thereby improving the file transfer efficiency. Further, the file upload instruction can be an instruction that requires the corresponding file to be uploaded to the server. Exemplarily, the user can perform the corresponding software upload operation on the browser, so that the browser can generate the corresponding file upload instruction based on the file upload operation, and send the file upload instruction to the upload component. Further, the file transfer task can be a task of transmitting the file corresponding to the file upload instruction. Specifically, the upload component can determine at least one file to be uploaded according to the file upload instruction, and arrange the transmission order of each file to be uploaded to create a file transfer task corresponding to the file upload instruction.
[0027] S120: The upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
[0028] Among them, the file to be uploaded may be a file that needs to be uploaded to the target server. Specifically, the file to be uploaded can be determined according to the file upload instruction. The task transmission order may be the transmission order of transmitting the file to be uploaded to the target server. The upload component may transmit the files to be uploaded corresponding to the file upload instruction to the corresponding target server in sequence according to the task transmission order. Further, the path to be stored may be the storage path of the file to be uploaded in the target server. Specifically, the upload component may determine the path to be stored corresponding to the file to be uploaded according to the file upload instruction. The target server may be a server that needs to store the file to be uploaded. Similarly, the target server may also be determined according to the file upload instruction.
[0029] The technical solution provided by the embodiment of the present invention is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication. When the upload component receives a file upload instruction sent by the browser, it creates a file transfer task according to the file upload instruction; based on the task transmission order in the file transfer task, the upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the upload component of the target server. The technical solution of the embodiment of the present invention solves the problem that the existing file transfer technology is mostly based on the transmission function in the browser to perform file transfer, which makes the file transfer process easily interfered by the browser status. The file transfer can be performed based on an upload component that is independent of the browser, and the file transfer process is no longer interfered by the browser status, thereby improving the file transfer efficiency.
[0030] Figure 2 It is another flow chart of a file transfer method provided by an embodiment of the present invention. The embodiment of the present invention can be applied to a scenario in which a file corresponding to a transfer instruction sent by a browser is transferred to a server. The method is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively communicated with the browser and the target server. Based on the above embodiment, this embodiment further illustrates how the upload component transfers the file to be uploaded corresponding to the file upload instruction to the upload component of the target server. The device can be implemented by software and / or hardware and integrated in a computer device with application development function.
[0031] like Figure 2 As shown, the file transfer method includes the following steps:
[0032] S210: When the upload component receives a file upload instruction sent by the browser, it creates a file transfer task according to the file upload instruction.
[0033] Among them, the upload component can be a component for uploading files to the corresponding server. The upload component can be a component independent of the browser. By making the upload component independent of the browser, the file transfer task of the upload component can be unaffected by the browser state, thereby improving the file transfer efficiency. Further, the file upload instruction can be an instruction that requires the corresponding file to be uploaded to the server. Exemplarily, the user can perform the corresponding software upload operation on the browser, so that the browser can generate the corresponding file upload instruction based on the file upload operation, and send the file upload instruction to the upload component. Further, the file transfer task can be a task of transmitting the file corresponding to the file upload instruction. Specifically, the upload component can determine at least one file to be uploaded according to the file upload instruction, and arrange the transmission order of each file to be uploaded to create a file transfer task corresponding to the file upload instruction.
[0034] S220: The upload component sends the storage path of the file to be uploaded to the target server based on the task transmission order in the file transmission task.
[0035] Among them, the file to be uploaded may be a file that needs to be uploaded to the target server. Specifically, the file to be uploaded can be determined according to the file upload instruction. The task transmission order may be the transmission order of transmitting the file to be uploaded to the target server. The upload component may transmit the files to be uploaded corresponding to the file upload instruction to the corresponding target server in sequence according to the task transmission order. Further, the path to be stored may be the storage path of the file to be uploaded in the target server. Specifically, the upload component may determine the path to be stored corresponding to the file to be uploaded according to the file upload instruction. The target server may be a server that needs to store the file to be uploaded. Similarly, the target server may also be determined according to the file upload instruction.
[0036] S230: The upload component obtains the associated file information corresponding to the path to be stored sent by the target server.
[0037] The associated file information may be file information of a local file in the path to be stored of the target server. The associated file information may include information such as the name of the local file (hereinafter referred to as the associated file) in the path to be stored of the target server, the memory occupied by the file, and the file identifier. Specifically, after sending the path to be stored of the file to be uploaded to the target server, the target server may search for files associated with the file to be uploaded based on the path to be stored, and send the file information of the associated file to the upload component, so that the uploaded file obtains the above-mentioned associated file information. By searching for the associated file information in the target server and sending the associated file information to the upload component, the upload component can determine the upload judgment result of the file to be uploaded and the starting point of the file upload based on the associated file information, thereby avoiding the transmission of redundant or repeated file content to the target server and improving the efficiency of file transmission.
[0038] S240: The upload component determines an upload determination result of the file to be uploaded according to the associated file information.
[0039] The upload determination result may be a result of determining whether the file to be uploaded needs to be transmitted to the target server. The upload determination result may include an uploadable result and a non-uploadable result. Exemplarily, the upload determination result may be determined based on the similarity between the associated file information and the file information of the file to be uploaded.
[0040] Optionally, determining an upload judgment result of the file to be uploaded based on the associated file information includes: the upload component compares the associated file memory in the associated file information with the target file memory of the file to be uploaded; when the associated file memory is smaller than the target file memory, determining that the upload judgment result is an uploadable result; when the associated file memory is equal to the target file memory, the upload component respectively determines the identification information of the associated file and the file to be uploaded to obtain first identification information and second identification information, and determines the upload judgment result based on the first identification information and the second identification information.
[0041] Among them, the associated file memory can be the occupied memory of the associated file. The target file memory can be the occupied memory of the file to be uploaded. Furthermore, when the associated file memory is smaller than the target file memory, it means that only part of the file content of the file to be uploaded is stored in the target server, that is, the target server does not store the complete file content of the file to be uploaded. At this time, it is necessary to complete the file content of the file to be uploaded in the target server, so it can be determined that the upload judgment result is an uploadable result. Optionally, when the associated file memory is larger than the target file memory, it means that the associated file in the target server is different from the file to be uploaded. At this time, it can also be determined that the upload judgment result is an uploadable result.
[0042] Furthermore, when the associated file memory is equal to the target file memory, the associated file may be the same as the file to be uploaded, so it is necessary to further determine whether the file information of the two files is completely identical. The first identification information may be the identification information of the associated file. The second identification information may be the identification information of the file to be uploaded. The identification information may be identification information indicating the unique identity of the file. Further, the first identification information and the second identification information may be compared, and the upload determination result may be determined based on the comparison result.
[0043] Optionally, identification information of the associated file and the file to be uploaded is respectively determined to obtain first identification information and second identification information, and an upload determination result is determined according to the first identification information and the second identification information, including: the upload component respectively determines the cryptographic hash function values of the associated file and the file to be uploaded to obtain a first cryptographic hash function value and a second cryptographic hash function value; when the first cryptographic hash function value and the second cryptographic hash function value are the same, determining that the upload determination result is an unuploadable result; when the first cryptographic hash function value and the second cryptographic hash function value are different, determining that the upload determination result is an uploadable result.
[0044] Among them, the first cryptographic hash function value can be a cryptographic hash function value of the associated file. The second cryptographic hash function value can be a cryptographic hash function value of the file to be uploaded. Among them, the cryptographic hash function value can be an MD5 value. Specifically, the cryptographic hash function value can be determined by determining the hash value of the file, and then determined based on the hash value. Further, if the first identification information and the second identification information are the same. It means that the file to be uploaded and the associated file are the same, and at this time it can be determined that the upload determination result is a non-uploadable result. Correspondingly, if the first identification information and the second identification information are different, it means that the file to be uploaded and the associated file are different, and at this time it can be determined that the upload determination result is an uploadable result.
[0045] S250: When the upload determination result is an uploadable result, the upload component executes an operation of transmitting the file to be uploaded to the target server.
[0046] When the upload determination result is an uploadable result, it means that the target server does not have the complete file content of the file to be uploaded, so the upload component can perform the operation of transmitting the file to be uploaded to the target server.
[0047] Optionally, transmitting the file to be uploaded corresponding to the file upload instruction to the target server also includes: when the associated file memory is smaller than the target file memory, the upload component determines the file upload starting point of the file to be uploaded according to the associated file memory; the upload component transmits the file to be uploaded to the target server based on the file upload starting point; wherein the file upload starting point is the starting point for data transmission of the file to be uploaded to the target server.
[0048] Among them, the file upload starting point can be determined according to the size of the associated file memory. Optionally, the previous associated file memory of the file to be uploaded can be used as the file upload starting point. For example, if the memory size of the file to be uploaded is 15G and the memory of the associated file is 12G, the 12G of the file to be uploaded can be used as the file upload starting point, that is, the last 3G file content of the file to be uploaded is transmitted to the target server. By determining the file upload starting point and transmitting the file to be uploaded to the target server based on the file upload starting point, on the one hand, it is possible to avoid transmitting redundant and repeated file content to the target server, reduce file transfer content, and improve file transfer efficiency; on the other hand, it is also possible to avoid the target server storing redundant and repeated file content, thereby improving file storage utilization.
[0049] Optionally, the upload component may also obtain the length of the transferred data of the file to be uploaded at preset intervals; the upload component determines the current transmission progress information according to the length of the transferred data and the total length of the data of the file to be uploaded, and sends the current transmission progress information to the browser.
[0050] Among them, the preset period can be a preset period for providing feedback on the current transmission progress of the file to be uploaded. Specifically, the preset period can be set manually. Further, the length of the transmitted data can be the length of the data in the file to be uploaded that has been transmitted to the target server. Specifically, the upload component can record the transmission data length of the file to be uploaded, and then determine the length of the transmitted data corresponding to each preset period. The total data length can be the length of the file data that needs to be transmitted to the target server in the file to be uploaded. Specifically, the total data length can be determined based on the memory size of the file to be uploaded and the file upload starting point. For example, the memory size of the file to be uploaded can be subtracted from the file memory before the file upload starting point, and then the total data length can be obtained. Further, the current transmission progress information can be the transmission completion progress information about the file to be uploaded at the current moment. Specifically, the transmitted data length can be compared with the total data length, and the ratio obtained can be used as the current transmission progress information. Further, the current transmission progress information can be sent to the browser so that the browser receives feedback information corresponding to the file upload instruction.
[0051] Optionally, data communication is performed between the upload component and the browser based on a first network communication protocol, and the first network communication protocol includes at least the WebSocket protocol; data communication is performed between the upload component and the target server based on a second network communication protocol, and the second network communication protocol includes at least the FTP protocol.
[0052] Among them, the upload control can use the websocket communication protocol to communicate and interact with the browser. Websocket is a protocol for full-duplex communication on a single TCP connection, which can achieve continuous communication between the client and the server, improve the user experience, and enable more real-time data communication. After the browser client successfully connects to the upload control, the upload control saves the browser user connection status for subsequent communication.
[0053] Furthermore, compared to the HTTP protocol, FTP supports multiple types of file transfers, including binary and ASCII format files. It does not add meta-data to the sent data, and only transfers the original binary file. Secondly, FTP has a fast transmission speed and can transfer a large amount of data in a short time. FTP supports bidirectional file transfer, that is, files can be uploaded and downloaded in both directions, minimizing the round-trip delay. By communicating data between the upload component and the target server based on the FTP protocol, the efficiency of file transfer can be greatly improved.
[0054] In addition, the HTTP protocol has a limit on the length of the request. Most modern browsers limit the request size to about 100KB to 1MB, so using the POST request to send large data requires slicing the data and sending multiple requests. FTP supports bidirectional file transfer, that is, files can be uploaded and downloaded in both directions, minimizing the round-trip delay in the request-response mode.
[0055] For example, Figure 3 The present invention provides a workflow diagram for performing file transmission.
[0056] like Figure 3 As shown, the workflow of file transfer includes the following steps:
[0057] When used, the browser creates a command and sends it to the C# client (upload control) to execute the upload task. After the upload control receives the browser command through the websocket connection, it parses the command parameters to obtain the address of the uploaded file, the target server and other command parameters, and then integrates the parameters into the command to be executed and adds it to the queue (enter the queue) to execute the tasks sequentially. After the program detects the task in the queue, it immediately takes out the task at the head of the queue (dequeue) for execution. The concurrency control during upload is performed through the first-in-first-out feature of the queue. Only one task is executed, and other tasks are queued in the order of entry to wait for execution. The queue can be used as a buffer to cache task data. It is suitable for concurrent tasks in a multi-threaded environment to ensure the stability of the system. Use FtpClient to transfer local files to the specified storage path of the FTP server:
[0058] 1. Establish a connection: Instantiate the FtpClient client and create a connection with the FTP server through the FTP service IP, username, and password.
[0059] 2. Logical processing of data and breakpoint resumption: When uploading files through the FTP client, the local files are segmented, and the data transmission is performed cyclically and appended to the FTP server; before transmission, the file on the FTP server is judged to exist and the file size is compared with the local file. If it is judged that the file to be uploaded does not exist on the server, the source file is uploaded directly; if it is judged that the file to be uploaded exists on the server, the server file size is obtained and compared with the local file. If the server file is less than the file to be uploaded, it means that the server file is incomplete. When uploading the file, the server file size (size) is used as the starting point of this upload, and the remaining file content of the file to be uploaded is read and segmented; if it is judged that the FTP server file size is the same as the file size to be uploaded, the MD5 value of the two files is used to check whether they are the same. If it is not uploaded (transfer in seconds), it is uploaded otherwise.
[0060] 3. Data transmission and real-time progress tracking: Segmented transmission is performed in a parallel loop, and a fixed-length data segment is transmitted each time. During the loop, the length of the transmitted data is accumulated and recorded through a variable. The real-time progress of the transmission is calculated by the transmitted length / total data length*100. The progress value is returned using the delegate method and fed back to the browser user of the current operation through the websocket connection.
[0061] If an unknown exception occurs during the transmission process, causing the transmission to be interrupted, the server file and the local file will be compared before the next upload to perform breakpoint resumption.
[0062] For example, Figure 4 FIG. 1 is another workflow diagram for performing file transfer provided by an embodiment of the present invention. Figure 4 As shown, the workflow of file transfer includes the following steps:
[0063] The browser creates a command and sends it to the upload control; the upload control then parses the command parameters, and the integrated parameter data is finally added to the task queue, then the task is taken out of the queue and the file is transferred based on the FTP protocol. Before starting to transfer the file, it will also determine whether there is a server file in the storage path. If not, the file can be uploaded to the server. If so, the server file size is compared with the local file size. If the server file size is greater than the uploaded file, it means that the server file and the local content are different, then the local file is uploaded to the server to replace the server file; if the server file size is less than the uploaded file, it means that the server file is incomplete, then when uploading the file, the server file size (size) is used as the starting point for this upload. , intercept the file content to be uploaded (breakpoint resume); if the server file = the uploaded file, compare the MD5 values of the two files. If the MD5 values are different, it means that the server file and the local file are different, then upload the local file to the server to replace the server file; if they are the same, it means that the service file and the local file are the same, and the upload is not performed and it returns directly (seconds); further, segmented transmission can be performed in a parallel loop, and a fixed-length data segment is transmitted each time. During the loop, the length of the transmitted data is accumulated and recorded through a variable. The real-time progress of the transmission is obtained by calculating the transmitted length / total data length*100. The progress value is returned using the delegate method and fed back to the browser user of the current operation through the websocket connection.
[0064] The technical solution provided by the embodiment of the present invention is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication, wherein the upload component creates a file transfer task according to the file upload instruction when receiving the file upload instruction sent by the browser; the upload component sends the storage path of the file to be uploaded to the target server based on the task transmission order in the file transfer task; the upload component obtains the associated file information corresponding to the storage path sent by the target server; the upload component determines the upload judgment result of the file to be uploaded according to the associated file information; and when the upload judgment result is an uploadable result, the upload component executes the operation of transmitting the file to be uploaded to the target server. The technical solution of the embodiment of the present invention solves the problem that the existing file transfer technology is mostly based on the transmission function in the browser to perform file transfer, resulting in the file transfer process being easily disturbed by the browser state, and can perform file transfer based on the upload component independent of the browser, and the file transfer process is no longer disturbed by the browser state, thereby improving the file transfer efficiency.
[0065] Figure 5It is a structural schematic diagram of a file transfer device provided by an embodiment of the present invention. The embodiment of the present invention can be applied to the scenario of transferring the file corresponding to the transfer instruction sent by the browser to the server. The device can be implemented by software and / or hardware and integrated into a computer device with application development function.
[0066] like Figure 5 As shown, the file transmission device includes: a transmission task creation module 310 and a file transmission module 320. The transmission task creation module 310 is used for the upload component to create a file transmission task according to the file upload instruction when receiving the file upload instruction sent by the browser; the file transmission module 320 is used for the upload component to transmit the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
[0067] The technical solution provided by the embodiment of the present invention is in the form of B+C: browser+c# client (upload control) mode. Install the C# client service on the computer and run it as a service in the background of the computer. The C# client uses the websocket communication protocol to communicate and interact with the browser. When used, the browser creates a command to send to the C# client (upload control) to perform the upload task, which can realize large file fragment transmission, concurrent upload, breakpoint continuation, real-time tracking of upload progress and try to feedback to the browser. Compared with the HTTP protocol, FTP supports multiple types of file transfers, can transmit binary and ASCII format files, does not add meta-data to the sent data, and only transmits the original binary file. Secondly, FTP has a fast transmission speed and can transmit a large amount of data in a short time. In addition, FTP supports breakpoint continuation and folder download functions, which can better cope with network instability, accidental interruption during transmission, etc., and ensure the security and reliability of transmission. FTP supports bidirectional file transfer, that is, files can be uploaded and downloaded in both directions, which minimizes the round-trip delay.
[0068] The present invention can realize the transmission of large files in pieces, control of concurrent uploads, breakpoint continuation, real-time tracking of upload progress and try to feedback to the browser. If the browser is accidentally closed midway, it will not have any impact on the upload task. The background service of the upload control will continue to execute the upload task until the file is uploaded, which greatly improves the user experience.
[0069] The technical solution provided by the embodiment of the present invention is applied to a file transfer system, wherein the file transfer system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication. When the upload component receives a file upload instruction sent by the browser, it creates a file transfer task according to the file upload instruction; based on the task transmission order in the file transfer task, the upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the upload component of the target server. The technical solution of the embodiment of the present invention solves the problem that the existing file transfer technology is mostly based on the transmission function in the browser to perform file transfer, which makes the file transfer process easily interfered by the browser status. The file transfer can be performed based on an upload component that is independent of the browser, and the file transfer process is no longer interfered by the browser status, thereby improving the file transfer efficiency.
[0070] In an optional embodiment, the file transfer module 320 is specifically used for: the upload component sends the to-be-uploaded file path to the target server, and obtains the associated file information corresponding to the to-be-uploaded path sent by the target server; wherein the associated file information is the file information associated with the to-be-uploaded file determined by the target server from the local file based on the to-be-stored path; the upload component determines the upload judgment result of the to-be-uploaded file according to the associated file information; wherein the upload judgment result includes an uploadable result and a non-uploadable result; when the upload judgment result is an uploadable result, the upload component executes the operation of transferring the to-be-uploaded file to the target server.
[0071] In an optional embodiment, the file transfer module 320 includes: an upload judgment result determination unit, which is used for: the upload component compares the associated file memory in the associated file information with the target file memory of the file to be uploaded; when the associated file memory is smaller than the target file memory, determining that the upload judgment result is an uploadable result; when the associated file memory is equal to the target file memory, the upload component respectively determines the identification information of the associated file and the file to be uploaded to obtain the first identification information and the second identification information, and determines the upload judgment result according to the first identification information and the second identification information.
[0072] In an optional embodiment, the upload judgment result determination unit includes: an identification information analysis subunit, used for: the upload component determines the cryptographic hash function values of the associated file and the file to be uploaded respectively, to obtain a first cryptographic hash function value and a second cryptographic hash function value; when the first cryptographic hash function value and the second cryptographic hash function value are the same, determining that the upload judgment result is an unuploadable result; when the first cryptographic hash function value and the second cryptographic hash function value are different, determining that the upload judgment result is an uploadable result.
[0073] In an optional embodiment, the file transfer module 320 also includes: a file upload starting point determination unit, which is used to: when the associated file memory is smaller than the target file memory, the upload component determines the file upload starting point of the file to be uploaded according to the associated file memory; the upload component transfers the file to be uploaded to the target server based on the file upload starting point; wherein the file upload starting point is the starting point for data transmission of the file to be uploaded to the target server.
[0074] In an optional embodiment, the file transfer device also includes: a transmission progress feedback module, which is used for: the upload component to obtain the length of the transmitted data of the file to be uploaded at every preset period; the upload component determines the current transmission progress information based on the length of the transmitted data and the total length of the data of the file to be uploaded, and sends the current transmission progress information to the browser.
[0075] In an optional embodiment, data communication is performed between the upload component and the browser based on a first network communication protocol, and the first network communication protocol includes at least a WebSocket protocol; data communication is performed between the upload component and the target server based on a second network communication protocol, and the second network communication protocol includes at least an FTP protocol.
[0076] The file transmission device provided in the embodiment of the present invention can execute the file transmission method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0077] Figure 6 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 6 A block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 6 The computer device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The computer device 12 can be any terminal device with computing capability and can be configured in a file transmission device.
[0078] like Figure 6 As shown, the computer device 12 is in the form of a general-purpose computing device. The components of the computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).
[0079] The bus 18 may be one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. For example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0080] The computer device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 12, including volatile and non-volatile media, removable and non-removable media.
[0081] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. The computer device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0082] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0083] The computer device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the computer device 12, and / or any device that enables the computer device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed through an input / output (I / O) interface 22. Furthermore, the computer device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) through a network adapter 20. Figure 6 As shown, the network adapter 20 communicates with other modules of the computer device 12 via the bus 18. It should be understood that although Figure 6 Not shown, other hardware and / or software modules may be used in conjunction with computer device 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0084] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing the file transmission method provided in the embodiment of the present invention, which is applied to a file transmission system, wherein the file transmission system includes a browser, a target server, and an upload component respectively connected to the browser and the target server in communication, and the file transmission method includes:
[0085] When the upload component receives a file upload instruction sent by the browser, the upload component creates a file transfer task according to the file upload instruction;
[0086] The upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
[0087] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the file transmission method provided by any embodiment of the present invention is implemented, and the program is applied to a file transmission system. The file transmission system includes a browser, a target server, and an upload component that is respectively connected to the browser and the target server in communication. The file transmission method includes:
[0088] When the upload component receives a file upload instruction sent by the browser, the upload component creates a file transfer task according to the file upload instruction;
[0089] The upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
[0090] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0091] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0092] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0093] Computer program code for performing the operations of the present invention may be written in one or more programming languages or combinations thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0094] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0095] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A file transfer method, It is characterized in that Applied to a file transmission system, the file transmission system includes a browser, a target server, and an upload component respectively connected to the browser and the target server in communication, the file transmission method includes: When the upload component receives a file upload instruction sent by the browser, the upload component creates a file transfer task according to the file upload instruction; The upload component transmits the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transmission task.
2. The method according to claim 1, It is characterized in that The step of transmitting the to-be-uploaded file corresponding to the file upload instruction to the target server includes: The upload component sends the path to be stored of the file to be uploaded to the target server, and obtains the associated file information corresponding to the path to be stored sent by the target server; wherein the associated file information is the file information associated with the file to be uploaded determined by the target server from the local file based on the path to be stored; The upload component determines the upload determination result of the file to be uploaded according to the associated file information; wherein the upload determination result includes an uploadable result and a non-uploadable result; When the upload determination result is an uploadable result, the upload component performs an operation of transmitting the file to be uploaded to the target server.
3. The method according to claim 2, It is characterized in that The determining the upload determination result of the to-be-uploaded file according to the associated file information includes: The uploading component compares the associated file memory in the associated file information with the target file memory of the file to be uploaded; In the case where the associated file memory is smaller than the target file memory, determining that the upload determination result is an uploadable result; When the associated file memory is equal to the target file memory, the upload component determines the identification information of the associated file and the file to be uploaded respectively to obtain first identification information and second identification information, and determines the upload determination result according to the first identification information and the second identification information.
4. The method according to claim 3, It is characterized in that The step of respectively determining the identification information of the associated file and the file to be uploaded to obtain first identification information and second identification information, and determining the upload determination result according to the first identification information and the second identification information, comprises: The upload component determines cryptographic hash function values of the associated file and the file to be uploaded respectively, and obtains a first cryptographic hash function value and a second cryptographic hash function value; When the first cryptographic hash function value and the second cryptographic hash function value are the same, determining that the upload determination result is an upload-unavailable result; In a case where the first cryptographic hash function value and the second cryptographic hash function value are different, the upload determination result is determined to be an uploadable result.
5. The method according to claim 3, It is characterized in that The step of transmitting the to-be-uploaded file corresponding to the file upload instruction to the target server also includes: In the case where the associated file memory is smaller than the target file memory, the upload component determines the file upload starting point of the file to be uploaded according to the associated file memory; The uploading component transmits the file to be uploaded to the target server based on the file uploading starting point; The file upload starting point is the starting point for data transmission of the file to be uploaded to the target server.
6. The method according to claim 1, It is characterized in that The method further comprises: The uploading component obtains the transmitted data length of the file to be uploaded at a preset period interval; The upload component determines current transmission progress information according to the length of the transmitted data and the total length of the data of the file to be uploaded, and sends the current transmission progress information to the browser.
7. The method according to claim 1, It is characterized in that The upload component and the browser communicate data based on a first network communication protocol, which includes at least the WebSocket protocol; the upload component and the target server communicate data based on a second network communication protocol, which includes at least the FTP protocol.
8. A file transmission device, It is characterized in that Applied to a file transfer system, the file transfer system includes a browser, a target server, and an upload component respectively connected to the browser and the target server in communication, the device includes: A transmission task creation module, used for the upload component to create a file transmission task according to the file upload instruction when receiving the file upload instruction sent by the browser; The file transfer module is used for the upload component to transfer the to-be-uploaded file corresponding to the file upload instruction to the target server upload component based on the task transmission order in the file transfer task.
9. A computer device, It is characterized in that The computer device comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the file transmission method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the file transmission method as described in any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Breakpoint unloading application control method
CN102497395A
Method and device for uploading and downloading file
CN103685557A
Browser-based file transfer method and device
CN109361754A
Method for uploading file through browser, browser and electronic equipment
CN111935227A
File uploading method and device based on WebUploader component, electronic equipment and readable storage medium
CN112068925A
