A file uploading method and system
By utilizing stable network transmission between the file server and the business server during the file upload process, and reducing network interaction between the client and the business server, the problem of low file upload efficiency and success rate in unstable network environments is solved, achieving more efficient file uploads.
Patent Information
- Application Number
- CN202410310542.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-19
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-03-19
AI Technical Summary
In unstable network environments, file uploads on client devices are prone to failure, resulting in low upload efficiency and success rate.
When the client sends a file upload request to the business server, it synchronously transmits business data, obtains the response packet, and uploads the target file to the file server. After successfully receiving the request, the file server directly notifies the business server to update the business data, reducing network interaction between the client and the business server.
By replacing unstable client-side network transmission with stable file server and business server network transmission, the number of network connections is reduced, improving the efficiency and success rate of file uploads.
Smart Images

Figure CN118316918B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data transmission, and in particular to a file uploading method and system. BACKGROUND
[0002] At present, there are various APPs (Application) and client devices in the Internet system, and these client devices can be used in various environments, such as domestic locations or foreign locations, wherein the network facilities are different in different locations, resulting in different network communication conditions between the client devices and the server. Under this basic network environment, each application program usually has the need of file uploading, wherein the files include pictures, videos and various file types. In order to meet the general function of file uploading, the server usually develops a general file server system.
[0003] On this basis, when the application program in the client device needs to perform file uploading, the client first requests the file uploading credential from the business server, and then calls the general file server for file uploading according to the credential. At this time, the client synchronously acquires the file ID after the file uploading, and finally calls the business server interface to realize the update of the business data according to the file ID and the business related data. In this process, if the basic network environment of the client is poor, the network communication condition between the client and the server will be unstable, and thus the whole file uploading process will fail. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a file uploading method and system, to reduce the unstable data transmission network caused by the client device in the file uploading process, and thus to improve the file uploading efficiency and success rate.
[0005] In order to solve the above technical problems, the technical scheme adopted by the present application is as follows:
[0006] A file uploading method, comprising:
[0007] The client generates a file uploading request, and sends the file uploading request and the business data corresponding to the file uploading request to the business server;
[0008] The business server generates a response packet according to the file uploading request and the business data, and sends the response packet to the client;
[0009] The client uploads a target file to the file server according to the response packet;
[0010] If the file server successfully receives the target file, the file server notifies the business server to update the business data according to the response packet.
[0011] To solve the above technical problems, another technical solution adopted by the present application is:
[0012] A file uploading system comprises:
[0013] A request module is configured to generate a file uploading request by a client and send the file uploading request and service data corresponding to the file uploading request to a service server;
[0014] A response module is configured to generate a response packet by the service server according to the file uploading request and the service data and send the response packet to the client;
[0015] An uploading module is configured to upload a target file to a file server by the client according to the response packet;
[0016] An updating module is configured to notify the service server to update the service data according to the response packet by the file server if the target file is successfully received.
[0017] The present application has the beneficial effect that the client synchronously transmits service data while sending a file uploading request to a service server to obtain a response packet corresponding to the service server. After the client uploads a target file to a file server according to the response packet, the file server directly notifies the service server to update the service data according to the response packet, without calling the service server again to update the service data through the client. In this way, the stable network transmission between the file server and the service server is used to replace the unstable network transmission between the client and the service server, which effectively reduces the data transmission of the unstable network of the client in the file uploading process, thereby improving the file uploading efficiency and success rate of the client. BRIEF DESCRIPTION OF DRAWINGS
[0018] Figure 1 A step flow chart of a file uploading method provided for the embodiment of the present application;
[0019] Figure 2 A data interaction schematic diagram of a file uploading method provided for the embodiment of the present application;
[0020] Figure 3 A structure schematic diagram of a file uploading system provided for the embodiment of the present application;
[0021] Figure 4 A structure schematic diagram of another file uploading system provided for the embodiment of the present application;
[0022] LABEL EXPLANATION
[0023] 200. A file uploading system; 201. A client; 202. A service server; 203. A file server; 2011. A sending module; 2012. An uploading module; 2021. A service generating module; 2022. An updating module; 2023. A replying module; 2031. A responding module; 2032. A file generating module; 2033. A notification generating module; 2034. A forwarding module. DETAILED DESCRIPTION
[0024] To make the technical contents of the present application, the achieved purposes and effects more clear, the following will be described in combination with the embodiments and the accompanying drawings.
[0025] Please refer to Figure 1 The embodiment of the present application provides a file uploading method, comprising:
[0026] The client generates a file uploading request and sends the file uploading request and service data corresponding to the file uploading request to the service server;
[0027] The service server generates a response packet according to the file uploading request and the service data and sends the response packet to the client;
[0028] The client uploads a target file to the file server according to the response packet;
[0029] If the file server successfully receives the target file, the file server notifies the service server to update the service data according to the response packet.
[0030] From the above description, the beneficial effects of the present application are that the client synchronously transmits service data while sending a file uploading request to the service server to obtain a response packet corresponding to the service server. After the client uploads a target file to the file server according to the response packet, the file server directly notifies the service server to update the service data according to the response packet, without calling the service server through the client for updating. In this way, the stable network transmission between the file server and the service server is used to replace the unstable network transmission between the client and the service server, which effectively reduces the data transmission of the unstable network of the client in the file uploading process, thereby improving the file uploading efficiency and success rate of the client.
[0031] Further, the response packet comprises an uploading token and a service identifier;
[0032] The service server generates a response packet according to the file uploading request and the service data, comprising:
[0033] The business server generates an upload token according to the file upload request, stores the business data into a preset directory, and generates a business identifier according to the directory.
[0034] As can be seen from the above description, the client obtains the upload token from the business server through the file upload request, so as to subsequently call the file server to perform the file upload operation. Meanwhile, the client synchronously uploads the business data to the business server to obtain the business identifier, so that the business server can subsequently find the business data corresponding to the file upload request again to update. In this way, the number of network connections between the client and the business server is reduced.
[0035] Further, the client uploading the target file to the file server according to the response packet comprises:
[0036] The client sends the upload token and the business identifier to the file server;
[0037] The file server returns a file upload path to the client according to the upload token;
[0038] The client uploads the target file to the file server according to the file upload path.
[0039] As can be seen from the above description, the client uploads the target file to the file server while synchronously sending the upload token and the business identifier. The upload token is used for the file server to perform specific file upload operation, and the business identifier is used for the file server to directly notify the business server to update data. In this way, when the client interacts with the server, all related data is transmitted in this connection, avoiding secondary connection, so as to reduce unstable network connection.
[0040] Further, if the file server successfully receives the target file, the file server notifies the business server to update the business data according to the response packet, comprising:
[0041] If the file server successfully receives the target file, the file server generates a file identifier according to the target file;
[0042] The file server generates notification information according to the business identifier in the response packet and the file identifier, and sends the notification information to the business server;
[0043] If the business server receives the notification information, the business server finds the business data corresponding to the target file in the directory according to the business identifier, and updates the file data corresponding to the business data according to the file identifier.
[0044] From the above description, the file server synchronously generates a file identifier after successfully receiving the target file. At this time, the file server directly sends the file identifier and a business identifier to the business server for updating, instead of returning to the client to call the business server again for updating. In this way, the number of network transmissions between the client and the server is reduced, thereby reducing unstable networks during file uploading, and further improving the efficiency and success rate of file uploading.
[0045] Further, the business server, after receiving the notification information, further comprises:
[0046] The business server generates reply information and sends the reply information to the file server.
[0047] If the file server receives the reply information, the file server forwards the reply information to the client to notify the client that the file uploading request has been completed.
[0048] From the above description, after the business update is completed based on the stable network transmission between the business server and the file server, the file server still forwards the reply information to the client, without the client and the business server needing to connect to the network again. That is, the client performs network transmission with the business server and the file server once, so that the client only performs network transmission twice in the file transmission process. Compared with the existing scheme in which the client needs to perform network transmission three times, the present application effectively reduces the number of network transmissions of the client, thereby avoiding the participation of unstable networks of the client, and further improving the success rate of file uploading.
[0049] Please refer to Figure 3 Another embodiment of the present application provides a file uploading system, comprising a client, a business server and a file server.
[0050] The client is configured to generate a file uploading request and send the file uploading request and business data corresponding to the file uploading request to the business server.
[0051] The business server is configured to generate a response packet according to the file uploading request and the business data, and send the response packet to the client.
[0052] The client is further configured to upload a target file to the file server according to the response packet.
[0053] The file server is configured to notify the business server to update the business data according to the response packet if the target file is successfully received.
[0054] From the above description, the beneficial effects of the present application are that the client synchronously transmits the business data to obtain the corresponding response packet of the business server while sending the file upload request to the business server. After the client uploads the target file to the file server according to the response packet, the file server directly notifies the business server to update the business data according to the response packet, without calling the business server again for updating through the client. In this way, the stable network transmission between the file server and the business server is used to replace the unstable network transmission between the client and the business server, effectively reducing the data transmission of the unstable network of the client in the file upload process, thereby improving the file upload efficiency and success rate of the client.
[0055] Further, the response packet comprises an upload token and a business identifier; the business server comprises a business generation module;
[0056] The business generation module is configured to generate an upload token according to the file upload request, and store the business data in a preset directory, and generate a business identifier according to the directory.
[0057] From the above description, the client obtains the upload token from the business server through the file upload request, so as to subsequently call the file server for file upload operation. At the same time, the client synchronously uploads the business data to the business server for storage to obtain the business identifier, so that the business server can find the corresponding business data for updating again through the business identifier. In this way, the number of network connections between the client and the business server is reduced.
[0058] Further, the client comprises a sending module and an uploading module, and the file server comprises a response module;
[0059] The sending module is configured to send the upload token and the business identifier to the file server;
[0060] The response module is configured to return a file upload path to the client according to the upload token;
[0061] The uploading module is configured to upload the target file to the file server according to the file upload path.
[0062] From the above description, the client uploads the target file to the file server while synchronously sending the upload token and the business identifier. The upload token is used for the file server to perform specific file upload operation, and the business identifier is used for the file server to directly notify the business server to update the data. In this way, when the client interacts with the server, all related data is transmitted in this connection to avoid secondary connection, so as to reduce unstable network connection.
[0063] Further, the file server further comprises a file generation module and a notification generation module, and the service server further comprises an update module;
[0064] The file generation module is configured to generate a file identifier according to the target file if the target file is successfully received.
[0065] The notification generation module is configured to generate notification information according to the service identifier in the response packet and the file identifier, and send the notification information to the service server.
[0066] The update module is configured to, if the notification information is received, search for service data corresponding to the target file in the directory according to the service identifier, and update file data corresponding to the service data according to the file identifier.
[0067] As can be seen from the above description, the file server synchronously generates a file identifier after successfully receiving a target file. At this time, the file server directly sends the file identifier and a service identifier to the service server for updating, instead of returning to the client and then calling the service server again for updating by the client. In this way, the number of network transmissions between the client and the server is reduced, thereby reducing unstable network during file uploading, and further improving the efficiency and success rate of file uploading.
[0068] Further, the service server further comprises a reply module, and the file server further comprises a forwarding module.
[0069] The reply module is configured to generate reply information and send the reply information to the file server.
[0070] The forwarding module is configured to, if the reply information is received, forward the reply information to the client to notify the client that the file uploading request has been completed.
[0071] As can be seen from the above description, after the service update is completed based on stable network transmission between the service server and the file server, the file server still forwards the reply information to the client, without the need for the client to connect to the service server again. That is, the client performs network transmission with the service server and the file server once, so that the client only performs network transmission twice during file transmission. Compared with the existing scheme in which the client needs to perform network transmission three times, the number of network transmissions of the client is effectively reduced, thereby avoiding the participation of unstable network of the client, and further improving the success rate of file uploading.
[0072] The embodiment of the present application provides a file uploading method and system, which can be used for performing file uploading operation by a client in a weak network environment, so as to reduce unstable data transmission network caused by the client device in the file uploading process, thereby improving file uploading efficiency and success rate. The following will be described by specific embodiments.
[0073] Please refer to Figures 1-2 The embodiment one of the present application is:
[0074] A file uploading method comprises:
[0075] S1, a client generates a file uploading request, and sends the file uploading request and service data corresponding to the file uploading request to a service server.
[0076] It should be noted that the client pre-acquires file parameters related to target file uploading, and generates a file uploading request according to the file parameters. In addition, the service data corresponding to the file uploading request is determined by the service content executed by the client. For example, the target file to be uploaded by the current client in the social application program is a picture, and then the client needs to acquire file parameters including account ID, publishing content ID and publishing time.
[0077] S2, the service server generates a response packet according to the file uploading request and the service data, and sends the response packet to the client.
[0078] Specifically, the response packet comprises an uploading token and a service identifier, and step S2 comprises:
[0079] S21, the service server generates an uploading token according to the file uploading request, and stores the service data in a preset directory, and generates a service identifier according to the directory.
[0080] It should be noted that, compared with the method that the client uploads the target file to the file server, and then connects the service server again to update the service data, the present application uploads the service data to the service server for storage when the client requests to acquire the uploading token, so that the client does not need to connect the service server again after completing the file uploading, and can directly call the service server to update the service data stored by the service server based on the file server, so as to reduce the network connection between the client and the server.
[0081] S3, the client uploads the target file to the file server according to the response packet.
[0082] Specifically, the step S3 comprises:
[0083] S31, the client sends the uploading token and the service identifier to the file server.
[0084] It should be noted that the client sends the upload token and the business identifier as file upload parameters to the file server at the same time, wherein the upload token is used to obtain the file upload path, and the business identifier is used for subsequent file upload success to directly call the business server by the file server for updating.
[0085] S32, the file server returns the file upload path to the client according to the upload token.
[0086] S33, the client uploads the target file to the file server according to the file upload path.
[0087] S4, if the file server successfully receives the target file, the file server informs the business server to update the business data according to the response package.
[0088] The step S4 comprises:
[0089] S41, if the file server successfully receives the target file, the file server generates a file identifier according to the target file.
[0090] S42, the file server generates notification information according to the business identifier in the response package and the file identifier, and sends the notification information to the business server.
[0091] S43, if the business server receives the notification information, the business server finds the business data corresponding to the target file in the directory according to the business identifier, and updates the file data corresponding to the business data according to the file identifier.
[0092] In some embodiments, if the file server does not successfully receive the target file, the file server returns upload failure information to the client, and ends the file upload process. Therefore, when the file upload operation between the client and the file server is completed, the client will no longer participate in the subsequent data transmission process, but will complete the subsequent update process through the stable server network between the file server and the business server.
[0093] The step S43 further comprises:
[0094] S431, the business server generates reply information and sends the reply information to the file server.
[0095] S432, if the file server receives the reply information, the file server forwards the reply information to the client to inform the client that the file upload request has been completed.
[0096] It should be noted that the file server determines whether the reply information of the service server is received, so as to confirm whether the notification information is sent successfully, and returns the reply information to the client to inform that the file uploading operation is successful at the same time when the file server confirms that the notification information is sent successfully.
[0097] Please refer to Figures 3-4 Embodiment two of the present application is:
[0098] A file uploading system 200 includes a client 201, a service server 202 and a file server 203. The client 201 is configured to generate a file uploading request and send the file uploading request and service data corresponding to the file uploading request to the service server 202. The service server 202 is configured to generate a response packet according to the file uploading request and the service data and send the response packet to the client 201. The client 201 is further configured to upload a target file to the file server 203 according to the response packet. The file server 203 is configured to notify the service server 202 to update the service data according to the response packet if the target file is successfully received.
[0099] In some embodiments, the client 201 includes a sending module 2011 and an uploading module 2012, the service server 202 includes a service generating module 2021, an updating module 2022 and a reply module 2023, and the file server 203 includes a response module 2031, a file generating module 2032, a notification generating module 2033 and a forwarding module 2034. The above modules are configured to perform respective corresponding steps or actions in the file uploading method of embodiment one, which will not be repeated here.
[0100] In summary, the file uploading method and system provided by the present application synchronously transmit the service data to the service server at the same time when the client sends the file uploading request to the service server, so as to obtain the uploading token corresponding to the service server and synchronously store the service data, without the secondary network interaction between the client and the service server. After the client uploads the target file to the file server according to the uploading token, the file identifier is obtained, and the corresponding service data is found in the service server according to the service identifier and the file identifier for updating, without calling the service server again through the client for updating. The network interaction between the client and the server is reduced after the client uploads the file. The stable network transmission between the file server and the service server is used to replace the unstable network transmission between the client and the service server, which effectively reduces the data transmission of the unstable network of the client in the file uploading process, thereby improving the file uploading efficiency and success rate of the client.
[0101] The above merely illustrates the embodiments of the present application, and is not intended to limit the patent scope of the present application. Any equivalent transformation or direct or indirect application in the related technical field based on the content of the present application specification and drawings is also included in the patent protection scope of the present application.
Claims
1. A file uploading method characterized by, The method comprises the following steps: The client generates a file upload request, and sends the file upload request and service data corresponding to the file upload request to a service server; The service server generates a response packet according to the file upload request and the service data, and sends the response packet to the client; The client uploads a target file to a file server according to the response packet; If the file server successfully receives the target file, the file server notifies the service server to update the service data according to the response packet; The response packet comprises an upload token and a service identifier; The service server generates an upload token according to the file upload request, stores the service data in a preset directory, and generates a service identifier according to the directory; The client sends the upload token and the service identifier to the file server; The file server returns a file upload path to the client according to the upload token; The client uploads the target file to the file server according to the file upload path; If the file server successfully receives the target file, the file server generates a file identifier according to the target file; The file server generates notification information according to the service identifier in the response packet and the file identifier, and sends the notification information to the service server; If the service server receives the notification information, the service server finds the service data corresponding to the target file in the directory according to the service identifier, and updates the file data corresponding to the service data according to the file identifier. After the service server receives the notification information, the service server further comprises the following steps: The service server generates a reply information, and sends the reply information to the file server; If the file server receives the reply information, the file server forwards the reply information to the client, so as to notify the client that the file upload request has been completed.
2. The method of claim 1, wherein, The method comprises the following steps: The client generates a file upload request, and sends the file upload request and service data corresponding to the file upload request to a service server; The service server generates a response packet according to the file upload request and the service data, and sends the response packet to the client; 3. A file upload system characterized by, The client uploads a target file to a file server according to the response packet; If the file server successfully receives the target file, the file server notifies the service server to update the service data according to the response packet; The response packet comprises an upload token and a service identifier; and the service server comprises a service generation module. The service generation module is configured to generate an upload token according to the file upload request, store the service data into a preset directory, and generate a service identifier according to the directory; The client comprises a sending module and an uploading module, and the file server comprises a responding module; The sending module is configured to send the upload token and the service identifier to the file server; The responding module is configured to return a file upload path to the client according to the upload token; The uploading module is configured to upload the target file to the file server according to the file upload path; The file server further comprises a file generation module and a notification generation module, and the service server further comprises an updating module; The file generation module is configured to generate a file identifier according to the target file if the target file is successfully received; The notification generation module is configured to generate notification information according to the service identifier and the file identifier in the response packet, and send the notification information to the service server; The updating module is configured to search for service data corresponding to the target file in the directory according to the service identifier if the notification information is received, and update file data corresponding to the service data according to the file identifier.
4. The file upload system of claim 3, wherein, The service server further comprises a reply module, and the file server further comprises a forwarding module; The reply module is configured to generate reply information and send the reply information to the file server; The forwarding module is configured to forward the reply information to the client if the reply information is received, so as to notify the client that the file upload request has been completed.
Citation Information
Patent Citations
Data backup and updating method of distributed file system
CN104202385A
Authorization server and authentication cooperation system
CN106856476A