File uploading method and system, vehicle and medium

By slicing and grouping files, combining browser concurrent request restrictions and network signal strength, a serial upload solution is adopted to solve the problems of memory leakage and low success rate when uploading files in the existing technology, and achieve efficient and large files Upload.

CN118921362APending Publication Date: 2024-11-08CHONGQING CHANGAN AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411167687.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-23
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

When the existing file shard uploading solution uploads super large files, it leads to browser memory leakage and excessive concurrency, reducing the upload success rate and affecting the user experience.

Method used

By slicing and grouping files to be uploaded based on file attributes, browser attributes and vehicle network status, uploading them using serial communication method, combining browser concurrent request restrictions and network signal strength to adjust the packet size to avoid browser memory overflow and transmission pressure .

Benefits of technology

It improves the success rate and efficiency of large file uploads, reduces costs, and meets users' needs for efficient uploads.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118921362A_ABST
    Figure CN118921362A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of file uploading, and discloses a file uploading method and system, a vehicle and a medium, and the method comprises the steps: determining a to-be-uploaded file based on a selection result when a selection operation of a user on a browser of a vehicle end is responded; slicing the to-be-uploaded file to obtain a plurality of small files; grouping all the small files based on the file attributes, the browser attributes and the vehicle end network state to obtain a plurality of file groups; and uploading all the file groups. According to the method, the concurrent attribute of the browser, the vehicle end network state and the attribute of the to-be-uploaded file are considered, the small files obtained after the to-be-uploaded file is sliced are grouped, and the grouped files are uploaded, so that the uploading rate of the browser can be utilized to a great extent, the memory leakage of the browser is effectively avoided, and the uploading efficiency of the to-be-uploaded file is improved. Therefore, the uploading success rate is improved, and the efficient uploading requirement of the user on the large file is greatly met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of file uploading, and in particular to a file uploading method, system, vehicle and medium. Background Art

[0002] File uploads in the front-end domain are often done through a unified interface provided by the browser. Users actively authorize access to local files, then read the file content into the specified memory, and finally execute the submit request operation to upload the file content data in the memory to the back-end server. Finally, the server parses the data information sent by the front-end and stores it in the file. Currently, common file upload methods include ordinary form upload, file encoding upload, formData asynchronous upload, and iframe non-refresh page upload.

[0003] In some platforms or system business scenarios, the size of uploaded videos, update packages, applications, and other files can be as large as 10G or more. The entire process of uploading such large files will be relatively long. During the process, users cannot refresh the page and can only wait patiently for the request to complete. After failure, they need to start the upload again. The common solution is to upload in pieces, that is, to slice a large file into multiple small files, upload them in parallel through the request interface, and merge all the piece files on the server side after all requests are responded to. When the piece upload fails, you can make a judgment when re-uploading and only upload the part that failed last time, reducing the user's waiting time and relieving the server pressure.

[0004] The existing file segmentation solution is to separate the file into small files on the front end, and then upload it in a loop and request the back-end interface in parallel. However, when uploading an extremely large file, the number of small files divided is very large. At this time, a large number of parallel requests will cause huge pressure on the server. On the other hand, the circular upload will cause a large number of instantaneous concurrency, which is very likely to cause a memory leak in the browser, thereby greatly reducing the upload success rate. For example: In the Internet of Vehicles scenario, the user needs to upload a 10G image file to the backend server. If the front end is cut into small blocks of 5M files, the number of cuts is as high as 2048, which means 2048 parallel requests to upload small files. The request success rate will be very low, and multiple breakpoint retransmissions will be required later to complete all requests. Therefore, the existing large file upload has the problems of high time cost, cumbersome operation, and low efficiency, which seriously affects the user experience. Summary of the invention

[0005] In view of this, the present invention provides a file uploading method, system, vehicle and medium to solve the problem raised in the above technical background that file uploading has high cost, cumbersome operation, low success rate and is difficult to meet users' demand for efficient uploading of large files due to the large amount of file data to be processed.

[0006] In a first aspect, the present invention provides a file uploading method, which is applied to a vehicle side, and the method comprises:

[0007] In response to a selection operation by a user on a browser on the vehicle side, determining a file to be uploaded based on the selection result;

[0008] Slice the file to be uploaded to obtain multiple small files;

[0009] All small files are grouped based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups;

[0010] Upload all files in groups.

[0011] The present invention groups all small files obtained by slicing the files to be uploaded selected by the user based on file attributes, browser attributes and vehicle-side network status, and uploads the grouped file groups, which can simplify the upload process, reduce the upload cost, effectively improve the success rate of large file uploads, and meet the user's demand for efficient large file upload.

[0012] In an optional implementation, all small files are grouped based on file attributes, browser attributes, and vehicle-side network status to obtain multiple file groups, including:

[0013] Cluster all small files to obtain multiple category groups;

[0014] Count the number of category files corresponding to each category group respectively;

[0015] Determine the number of target files based on the concurrent request limit of the browser on the vehicle side;

[0016] Determine whether the number of files in each category is greater than the number of target files;

[0017] If yes, the corresponding category groups are grouped based on the number of target files, and multiple file groups are obtained accordingly;

[0018] If not, the corresponding category group is determined as a file group.

[0019] The present invention divides all small files by attributes through clustering, and limits the number of files in each file group in combination with the browser concurrent request limit, so as to achieve accurate division of all small files, avoid the browser memory overflow problem caused by a large number of simultaneous uploads of multiple small files, and thus ensure the success rate of file upload.

[0020] In an optional implementation, after determining the number of target files based on the concurrent request limit of the vehicle-side browser, the file uploading method further includes:

[0021] Detect the current network signal on the vehicle side;

[0022] Determine the current number of files corresponding to the current network signal based on a preset relationship, wherein the preset relationship is a mapping relationship between different signal strength intervals and the number of files;

[0023] When the current number of files is less than the target number of files, the target number of files is updated, and the current number of files is used as the updated target number of files.

[0024] The present invention takes into account the current network status of the vehicle side during the grouping process, and adaptively adjusts the number of files in the group based on the mapping relationship between different signal strength intervals and the number of files, which can reduce the packet loss rate of file transmission and enhance the success rate of file uploading.

[0025] In an optional implementation, the file to be uploaded is sliced ​​to obtain multiple small files, including:

[0026] Determine the file size of the file to be uploaded;

[0027] Determine the slice size based on a preset upload rate;

[0028] Determine the number of tiles based on the file size and tile size;

[0029] The uploaded file is split into multiple small files based on the number of slices.

[0030] The present invention determines the slice size based on the size of the file to be uploaded and the set file upload rate, and slices the file to be uploaded based on the slice size, which can ensure the rationality of small file slicing and thus improve the success rate of subsequent file uploads.

[0031] In an optional implementation, all file groups are uploaded, including:

[0032] Each file group is uploaded sequentially using serial communication.

[0033] The present invention can alleviate the transmission pressure caused by uploading multiple files in parallel by uploading each file group in sequence, thereby ensuring the success and efficiency of uploading large files to a great extent.

[0034] In an optional implementation, the selection result includes files of different formats. In response to the selection operation of the user on the browser of the vehicle, the files to be uploaded are determined based on the selection result, including:

[0035] Detecting whether there is a file upload signal on the vehicle side, wherein the file upload signal is generated by the vehicle side in response to a user selecting a file to be uploaded on a browser on the vehicle side;

[0036] If it exists, obtain the corresponding file and determine that the file is the file to be uploaded;

[0037] If not, return to the step of detecting whether there is a file upload signal on the vehicle side.

[0038] The present invention can promptly respond to a file upload request initiated by a user by detecting the file upload signal at the vehicle end in real time, thereby improving the user experience to a certain extent.

[0039] In an optional implementation, before determining that the file is a file to be uploaded, the file uploading method further includes:

[0040] Determine whether the format corresponding to the file meets the preset standard format;

[0041] If yes, then executing the step of determining that the file is a file to be uploaded;

[0042] If not, the process returns to the step of determining the file to be uploaded based on the selection result in response to the user's selection operation on the vehicle-side browser.

[0043] The present invention can ensure the standardization of the file to be uploaded by detecting the format of the file to be uploaded, thereby helping to improve the effectiveness of file uploading.

[0044] In a second aspect, the present invention provides a file uploading system, which is applied to a vehicle side, and the system includes:

[0045] A response module, used to determine the file to be uploaded based on the selection result in response to the selection operation of the user on the browser of the vehicle end;

[0046] The slicing module is used to slice the file to be uploaded into multiple small files;

[0047] A grouping module is used to group all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups;

[0048] The upload module is used to upload all file groups.

[0049] The file upload system of the present invention groups sliced ​​files through the concurrency properties of the browser, the vehicle-side network status and the properties of the files to be uploaded. It can make the most of the browser's upload rate to effectively avoid the problem of browser memory leakage, which not only improves the upload success rate of large files, but also meets the user's demand for efficient upload of large files.

[0050] In a third aspect, the present invention provides a vehicle, comprising a controller, the controller comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes a file uploading method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0051] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute a file uploading method according to the first aspect or any corresponding embodiment thereof.

[0052] The file uploading method and system of the present invention groups all small files obtained by slicing the file to be uploaded selected by the user based on file attributes, browser attributes and vehicle-side network status, and uploads the grouped file groups. It fully considers the concurrency attributes of the browser, the vehicle-side network status and the properties of the file to be uploaded to achieve effective grouping of small files, can effectively avoid browser memory leakage problems, reduce the pressure of uploading multiple small files in parallel, and improve the success rate of file upload. It has the advantages of simple operation, stability and reliability, low cost and high efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0054] Figure 1 is a flowchart of a file uploading method according to an embodiment of the present invention;

[0055] Figure 2 is a flowchart of another file uploading method according to an embodiment of the present invention;

[0056] Figure 3 This is a schematic diagram of uploading a very large file based on slice grouping;

[0057] Figure 4 is a structural block diagram of a file upload system according to an embodiment of the present invention;

[0058] Figure 5 It is a schematic diagram of the structure of a controller of a vehicle according to an embodiment of the present invention. DETAILED DESCRIPTION

[0059] 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0060] An embodiment of the present invention provides an embodiment of a file uploading method. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0061] In this embodiment, a file uploading method is provided, which is applied to the vehicle side. Figure 1 is a flowchart of a file uploading method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0062] Step S101, in response to a selection operation by a user on a browser on the vehicle side, a file to be uploaded is determined based on the selection result.

[0063] In this embodiment, the user's selection operation on the vehicle-side browser is a specific document limitation operation for the file to be uploaded. The document type of the specific file involved is not limited here, and is adaptively adjusted based on actual needs, such as the document corresponding to the vehicle-side driving recorder, which is only used as an example.

[0064] Step S102, slicing the file to be uploaded to obtain multiple small files.

[0065] It should be noted that the specific implementation method of slicing the uploaded files in this embodiment is not limited here, and can be determined based on the adaptability of actual project requirements. For example, considering the increase in file upload rate in actual applications, slicing can be performed according to the file upload rate, which is only an exemplary description.

[0066] Step S103, grouping all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups.

[0067] In this embodiment, the specific contents of file attributes, browser attributes and vehicle-side network status are all adaptively adjusted based on actual project requirements. For example, file attributes include file size, type, editable attributes, generation time, etc.; browser attributes include the number of concurrent browsers, browsing speed, configuration parameters, etc.; vehicle-side network status is used to characterize the quality of the current network status, and the related parameters involved include signal strength, traffic supply, network speed, connection stability, etc., which are only for illustrative purposes.

[0068] Step S104, uploading all file groups.

[0069] The file uploading method of the embodiment of the present invention groups all small files obtained by slicing the file to be uploaded selected by the user based on file attributes, browser attributes and vehicle-side network status, and uploads the grouped file groups, which can simplify the upload process, reduce the upload cost, effectively improve the success rate of large file uploads, and meet the user's demand for efficient large file upload.

[0070] In this embodiment, a file uploading method is provided, which is applied to the vehicle side. Figure 2 FIG. 1 is a flow chart of another file uploading method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0071] Step S201, in response to the user's selection operation on the vehicle-side browser, determine the file to be uploaded based on the selection result.

[0072] In this embodiment, the selection result is a file containing different formats. It should be noted that the specific format of the file can be adaptively adjusted according to the actual file type supported by the vehicle end, such as the file corresponding to the driving recorder is in AVI format (Audio Video Interleaved). Specifically, the above step S201 includes:

[0073] Step A1, detecting whether there is a file upload signal on the vehicle side, wherein the file upload signal is generated by the vehicle side in response to the user's operation of selecting a file to be uploaded on the browser of the vehicle side.

[0074] In this embodiment, the specific content of the file upload signal is adaptively determined based on a conventional signal expression method in the art.

[0075] Step A2: if it exists, obtain the corresponding file and determine that the file is the file to be uploaded.

[0076] In this embodiment, the vehicle-side file is obtained through a vehicle-side network, such as a controller area network (CAN).

[0077] Step A3: If not, return to step A1 to detect whether there is a file upload signal on the vehicle side.

[0078] In the embodiment of the present invention, by real-time detection of the file upload signal on the vehicle side, a file upload request initiated by the user can be responded to in a timely manner, thereby improving the user experience to a certain extent.

[0079] In actual applications, since different types of vehicle terminals can support different formats of uploaded documents, the present embodiment also needs to perform format verification on the uploaded file to ensure the rationality of the uploaded file format. Specifically, before determining in the above step A2 that the file is a file to be uploaded, the file uploading method of the present embodiment also includes:

[0080] Step A21, determining whether the format corresponding to the file meets the preset standard format.

[0081] In this embodiment, the specific content of the preset standard format is adaptively adjusted based on the actual project model and the standard document types it can support. For example, for a certain vehicle, the standard format specified for its vehicle-side photo album is the JPEG (Joint Photographic Experts Group) format, which is only used as an example.

[0082] Step A22: If yes, execute step A2 of determining that the file is a file to be uploaded.

[0083] Step A23: If not, then return to step S201 to determine the file to be uploaded based on the selection result in response to the user's selection operation on the browser on the vehicle side.

[0084] In the embodiment of the present invention, by detecting the format of the file to be uploaded, the standardization of the file to be uploaded can be ensured, thereby helping to improve the effectiveness of file uploading.

[0085] Step S202, slicing the file to be uploaded to obtain multiple small files.

[0086] Specifically, the above step S202 includes:

[0087] Step S2021, determine the file size of the file to be uploaded.

[0088] In this embodiment, the specific method of determining the file size is not limited here, such as using the File object to obtain the file size. It should be noted that in front-end development, the File object refers to a file object, which is a data type representing a computer file. It is often associated with the file selected by the user through the file input box. It contains relevant information about the file, such as the file name, file size, file type, etc.

[0089] Step S2022, determining the slice size based on the preset upload rate.

[0090] In this embodiment, the specific value of the preset upload rate is not limited here and can be adaptively adjusted based on actual project requirements.

[0091] Step S2023, determining the number of slices based on the file size and the slice size.

[0092] Step S2024, split the file to be uploaded based on the number of slices to obtain multiple small files.

[0093] In the embodiment of the present invention, the slice size is determined based on the size of the file to be uploaded and the set file upload rate, and the file to be uploaded is sliced ​​based on the slice size, which can ensure the rationality of small file slicing and thus improve the success rate of subsequent file uploads.

[0094] Step S203, grouping all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups.

[0095] Specifically, the above step S203 includes:

[0096] Step S2031, clustering all small files to obtain multiple category groups.

[0097] In this embodiment, the specific implementation process of clustering is not limited here, and is set based on the adaptability of the actual project. For example, clustering algorithms such as K-means clustering algorithm, density clustering algorithm, Gaussian mixture model clustering algorithm, etc. are used only as an exemplary description.

[0098] Step S2032, counting the number of category files corresponding to each category group.

[0099] Step S2033, determine the number of target files based on the concurrent request limit of the vehicle-side browser.

[0100] In this embodiment, the browser concurrent request limit indicates the maximum concurrent number of the browser, which is an important factor affecting the browsing speed. Specifically, when actually browsing web pages, the concurrent number of the browser refers to the maximum number of web pages that the browser can work on at the same time. For example, if there are only 2 web pages working at the same time, that is, 2 concurrent connections, then the web page can only rely on these 2 threads when it is opened. If there is a slow web page content in the front, it will directly affect the opening of the content of the subsequent web page; but if there are more concurrent connections at the same time, the web page loading speed will be greatly improved. However, the larger the number of concurrent connections of the browser, the better. The larger the number of concurrent connections, the greater the pressure on file transfer and the easier it is to cause memory leaks in the browser.

[0101] Specifically, the above step S2033 includes:

[0102] Step B1, detect the current network signal at the vehicle end.

[0103] In this embodiment, the specific detection method of the network signal is not limited herein and is obtained based on conventional detection means in the art. For example, CW testing is a test using an omnidirectional single carrier. This type of test is often used to evaluate the performance and signal quality of in-vehicle communication devices, facilitate the selection of test frequencies and environments, and can effectively avoid test errors caused by other radio wave interferences and different antenna gains; in-network testing is a test conducted in an already operating network, which can more realistically reflect the performance of in-vehicle communication devices in the actual usage environment. Specifically, an in-vehicle test mobile phone is used to collect and record the pilot signal power data of each base station to truly reflect the current propagation situation of broadband signals in the local wireless environment, which is only for illustrative purposes.

[0104] Step B2, determine the current number of files corresponding to the current network signal based on a preset relationship, where the preset relationship is a mapping relationship between different signal strength intervals and the number of files.

[0105] In this embodiment, the network state of the current vehicle end is represented by the signal strength, i.e., RSSI (Received Signal Strength Indication), and the size of the file grouping is adaptively adjusted under different network states to ensure the successful upload of small-group files. Among them, the unit of RSSI is dBm. When the signal strength of the current vehicle end network state is in the interval [-95dBm, -90dBm], that is, -95dBm < RSSI < -90dBm, it indicates that the current network signal coverage is very weak. When slicing and grouping, the group can be divided into 2 pictures or 2 documents according to the number of groups.

[0106] Step B3, when the current number of files is less than the target number of files, update the target number of files and use the current number of files as the updated target number of files.

[0107] The embodiment of the present invention considers the current network state of the vehicle end during the grouping process and adaptively adjusts the number within the group based on the mapping relationship between different signal strength intervals and the number of files, which can reduce the packet loss rate of file transmission and enhance the success rate of file upload.

[0108] Step S2034, respectively determine whether the number of files in each category is greater than the target number of files.

[0109] Step S2035, if so, group the corresponding category groups based on the target number of files to obtain multiple file groups accordingly.

[0110] Step S2036: if not, the corresponding category group is determined as a file group.

[0111] In the embodiment of the present invention, all small files are divided into attribute groups through clustering, and the number of files in each file group is limited in combination with the browser concurrent request limit, which can achieve accurate division of all small files and avoid the browser memory overflow problem caused by a large number of simultaneous uploads of multiple small files, thereby ensuring the success rate of file upload.

[0112] Step S204, uploading all file groups.

[0113] Specifically, the above step S204 includes:

[0114] Step S2041, upload each file group in sequence using serial communication.

[0115] In this embodiment, the specific content of the upload method, upload progress and upload completion result of the file group is not limited here, and can be adaptively adjusted according to the actual project requirements. For example, file upload can be implemented based on Promise, where Promise, as a currently popular JavaScript asynchronous programming solution, can handle multiple interrelated asynchronous requests to solve the "callback hell" formed by multiple interdependent asynchronous requests in a nested manner. Among them, the Promise.all method can receive an array of Promise objects as a parameter, and will only be called when all requests are resolved. It is usually used to process multiple parallel asynchronous operations. In addition, the methods for uploading large files also include: stream processing method (processing partial data); using FormData objects (allowing the construction of form data collections containing key-value pairs) and then using XHR (XMLHttpRequest) or Fetch API to send it to the server; Observable processing method (allowing subscription to a sequence of values ​​or events and responding when these values ​​or events occur. RxJS is a JavaScript library for responsive programming using Observable).

[0116] In a specific embodiment, it is assumed that a function uploadFile is defined, which returns a Promise, indicating the result of the file upload, and simulates the asynchronous file upload process. In practice, XMLHttpRequest or Fetch API can be used to send a request, and then Promise.all can be used to upload all files in parallel.

[0117] The above content mainly involves the following processes and parameters:

[0118] 1) uploadFile function.

[0119] a. Accepts two parameters: file (representing the file to be uploaded) and groupId (representing the group number).

[0120] b. Return a Promise object for asynchronously processing file uploads.

[0121] c. Inside the Promise, a random upload progress (uploadPercentage) is simulated.

[0122] d. If the upload progress is less than 100%, an error is thrown through the reject method to simulate the upload failure.

[0123] e. If the upload progress reaches or exceeds 100%, the Promise is resolved through the resolve method, and an object containing file information, group sequence number, and upload progress is returned.

[0124] f. Use the setTimeout function to simulate the asynchronous upload process and add logic as needed.

[0125] 2) files array: can protect multiple objects, each object represents a file to be uploaded, and has a name attribute indicating the file name.

[0126] 3) groupId variable: initialized to 0, used to generate the group number of each file.

[0127] 4) managedUpload function.

[0128] a. Accepts a files array as a parameter.

[0129] b. Create an empty array uploadPromises to store the Promise objects of the upload operation.

[0130] c. Use a for...of loop to iterate over each file in the files array.

[0131] d. Inside the loop, generate a unique group number currentGroupId for each file and update the value of groupId through groupId++.

[0132] e. Use the try...catch statement to try to upload the file. Specifically, if the upload is successful (that is, the Promise of the uploadFile function is resolved), a success message is printed. If the upload fails (that is, the Promise of the uploadFile function is rejected), an error message is printed, and the logic of resuming the upload can be added in the catch block.

[0133] Finally, call managedUpload(files) to perform the upload operation.

[0134] It should be noted that the managedUpload function creates an array of uploadPromises, processes multiple file uploads in parallel, and waits for all uploads to complete, using Promise.all(uploadPromises). In addition, the logic of breakpoint resuming can be expanded according to actual needs to meet the needs of various scenarios.

[0135] In the embodiment of the present invention, by uploading each file group in sequence, the transmission pressure caused by uploading multiple files in parallel can be alleviated, thereby ensuring the success and efficiency of uploading large files to a great extent.

[0136] In a specific embodiment, a vehicle-side very large file upload solution based on slicing grouping is provided, specifically: after the vehicle's front-end operating system segments the large file, multiple segmented small files are obtained, and the concept of request task grouping is innovatively introduced. The groups are aggregated according to the document type on the vehicle side, and the number of concurrent requests on the front end is controlled (i.e., HTTP (Hypertext Transfer Protocol) requests a domain name to maintain about 6 TCP links (Transmission Control Protocol)), and the group size is controlled according to the strength of the network signal. This can avoid browser memory leaks and reduce the pressure on the server, thereby improving the success rate of large file uploads and improving the usage scenarios after receiving the files. Figure 3 This is a diagram of uploading a very large file based on slice grouping. Figure 3 The specific implementation steps include:

[0137] Step 1: Select the file to upload.

[0138] In this embodiment, the user selects large files to be uploaded, such as image files, video files, log files, etc., on the front end of the vehicle browser.

[0139] It should be noted that in a specific business scenario, the front-end and back-end need to verify the format of the uploaded file to prevent users from randomly uploading files of other formats. In this embodiment, after the user selects the file to be uploaded, the front-end uses the File object to obtain the file size, providing a basis for subsequent file slicing.

[0140] Step 2: Divide it into N small files evenly.

[0141] In this embodiment, the large uploaded file is evenly sliced to obtain N small files.

[0142] It should be noted that based on the file size calculated in Step 1, slicing processing is required. Generally, to improve the upload rate of small files, it is appropriate that the size of a single small file does not exceed 10M. Additionally, when slicing, the front-end needs to mark the slice serial number. Subsequently, the server calculates the start position based on the marked slice serial number and the size of each slice block in the requested data, and writes it together with the read file fragment data into the file.

[0143] Step 3: Grouping.

[0144] In this embodiment, the sliced small files, that is, each slice, are grouped to obtain M groups.

[0145] It should be noted that in this embodiment, according to the maximum concurrent HTTP connection number (usually 6, slightly different for different browsers), every 6 small files are combined into one group, and each group uses the Promise.all method to parallelly process the asynchronous upload operation. By means of grouped upload, the burden on the server can be reduced and the upload success rate can be improved.

[0146] It should be noted that during the grouping process, this embodiment can perform clustering grouping according to the type of document. For example, when uploading multiple videos or pictures, they can be grouped by video or picture classification, or several complete videos or pictures can be grouped. For example, when the HTTP connection number is 6, when grouping small slices, assuming that the current group contains 24 JEPG pictures, the small group can be grouped with 4 pictures as the number of the current group. In addition, the vehicle end can also control the size of the group according to the strength of the 4G or 5G network signal to ensure the transmission success rate and reduce the packet loss rate. For example, use the built-in AT command (such as AT+CSQ? for checking the network signal strength) at the vehicle end to detect the current 4G network signal quality; when -95dBm < RSSI < -90dBm, it means that the current network signal coverage is very weak, and when slicing and grouping, the group can be grouped with 2 as the number of groups; when RSSI > -90dBm, it means that the current network signal coverage is good, and when slicing and grouping, the group can be grouped with 4 as the number of groups.

[0147] Step 4: Complete the upload.

[0148] It should be noted that in this embodiment, when slicing and grouping files, the slices and group numbers need to be marked. Specifically, the grouped file slices are marked as groups, and uploaded in batches according to the marked serial numbers. In this embodiment, the purpose of the group serial number marking and the slice marking is to tag the file for failure marking in case of subsequent failure to upload some slices due to network failure or page closure. In actual applications, the unfinished part can be continued to be uploaded from the part of the file that has been uploaded (i.e., the tag) by resuming the upload from the breakpoint. Since the upload is not started from the beginning, the time for uploading files is greatly saved.

[0149] The file uploading method of the embodiment of the present invention has the following advantages:

[0150] 1. According to the concurrent number principle of the browser, control the number of slices in the group to overcome the problem of browser memory leakage.

[0151] 2. After slicing the file, the size is controlled based on the maximum concurrency of the browser, the vehicle-side network status, and the properties of the file to be uploaded. The method of slicing and grouping the file and then uploading it can make full use of the browser's upload rate and effectively avoid the problem of browser memory overflow caused by a large number of concurrent uploads in a loop. This greatly reduces the pressure of file uploading and helps to improve the upload success rate.

[0152] 3. When grouping, the vehicle side can control the size of the grouping according to the strength of the 4G or 5G network signal to ensure the transmission success rate and reduce the packet loss rate.

[0153] In summary, the file upload method of the embodiment of the present invention can effectively avoid browser memory leakage and reduce the pressure on the server by controlling the number of concurrent requests on the front end, thereby improving the upload success rate.

[0154] In this embodiment, a file upload system is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" refers to a combination of software and / or hardware that can implement a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0155] The present invention provides a file upload system, which is applied to a vehicle end, such as Figure 4 As shown, the system includes:

[0156] The response module 401 is used to determine the file to be uploaded based on the selection result in response to the user's selection operation on the browser of the vehicle side.

[0157] The slicing module 402 is used to slice the file to be uploaded to obtain multiple small files.

[0158] The grouping module 403 is used to group all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups.

[0159] The upload module 404 is used to upload all file groups.

[0160] In some optional embodiments, the response module 401 includes: a first response sub-module, a second response sub-module and a third response sub-module; wherein the first response sub-module is used to detect whether there is a file upload signal on the vehicle side, wherein the file upload signal is generated by the vehicle side in response to the user's selection operation of the file to be uploaded performed on the browser of the vehicle side; the second response sub-module is used to obtain the corresponding file if it exists, and determine that the file is a file to be uploaded; the third response sub-module is used to return to the step of detecting whether there is a file upload signal on the vehicle side if it does not exist.

[0161] In some optional embodiments, the second response submodule includes: a first response unit, a second response unit and a third response unit; wherein the first response unit is used to determine whether the format corresponding to the file meets the preset standard format; the second response unit is used to, if so, execute the step of determining that the file is a file to be uploaded; if not, the third response unit is used to return to the step of determining the file to be uploaded based on the selection result when responding to the user's selection operation on the browser on the vehicle side.

[0162] In some optional embodiments, the slicing module 402 includes: a first slicing sub-module, a second slicing sub-module, a third slicing sub-module and a fourth slicing sub-module; wherein the first slicing sub-module is used to determine the file size of the file to be uploaded; the second slicing sub-module is used to determine the slice size based on a preset upload rate; the third slicing sub-module is used to determine the number of slices based on the file size and the slice size; the fourth slicing sub-module is used to divide the file to be uploaded based on the number of slices to obtain multiple small files.

[0163] In some optional embodiments, the grouping module 403 includes: a first grouping submodule, a second grouping submodule, a third grouping submodule, a fourth grouping submodule, a fifth grouping submodule and a sixth grouping submodule; wherein the first grouping submodule is used to cluster all small files to obtain multiple category groups; the second grouping submodule is used to respectively count the number of category files corresponding to each category group; the third grouping submodule is used to determine the number of target files based on the concurrent request limit of the browser on the vehicle side; the fourth grouping submodule is used to respectively determine whether the number of files in each category is greater than the target number of files; the fifth grouping submodule is used to, if so, group the corresponding category groups based on the number of target files to obtain multiple file groups; the sixth grouping submodule is used to, if not, determine the corresponding category group as a file group.

[0164] In some optional embodiments, the third grouping submodule includes: a first grouping unit, a second grouping unit and a third grouping unit; wherein the first grouping unit is used to detect the current network signal on the vehicle side; the second grouping unit is used to determine the current number of files corresponding to the current network signal based on a preset relationship, wherein the preset relationship is a mapping relationship between different signal strength intervals and the number of files; the third grouping unit is used to update the target number of files when the current number of files is less than the target number of files, and use the current number of files as the updated target number of files.

[0165] In some optional implementations, the upload module 404 includes: an upload submodule, which is used to upload each file group in sequence using a serial communication method.

[0166] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.

[0167] The file upload system in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0168] The file upload system of the embodiment of the present invention groups sliced ​​files through the concurrency properties of the browser, the vehicle-side network status and the properties of the files to be uploaded. It can make the most of the browser's upload rate to effectively prevent browser memory leakage problems, thereby improving the upload success rate of large files and greatly meeting users' needs for efficient upload of large files.

[0169] A vehicle is also provided in an embodiment of the present invention, and the vehicle includes a controller. The controller in this embodiment is a vehicle controller, which is used to perform operations such as power supply / power off, sleep and wake up of the sub-controllers and network nodes under it, and each power supply interface thereof can collect the real-time current output. Other controllers with the above functions are applicable.

[0170] Figure 5 is a schematic diagram of the structure of the controller provided in an optional embodiment of the present invention, such as Figure 5 As shown, the controller includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the controller, including instructions stored in or on the memory to display graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple controllers can be connected, and each controller provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.

[0171] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0172] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.

[0173] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created according to the use of the controller, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the controller via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0174] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0175] The controller also includes a communication interface 30 for the main control chip to communicate with other devices or a communication network.

[0176] A computer-readable storage medium is also provided in an embodiment of the present invention. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor main control chip or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.

[0177] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A file uploading method, applied to a vehicle, characterized in that: The method comprises: In response to a selection operation by a user on a browser on the vehicle side, determining a file to be uploaded based on the selection result; Slice the file to be uploaded to obtain multiple small files; All small files are grouped based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups; Upload all files in groups.

2. The file uploading method according to claim 1, characterized in that: The method groups all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups, including: Cluster all small files to obtain multiple category groups; Count the number of category files corresponding to each category group respectively; Determine the number of target files based on the concurrent request limit of the browser on the vehicle side; Determine whether the number of files in each category is greater than the target number of files; If yes, the corresponding category groups are grouped based on the number of target files to obtain a plurality of corresponding file groups; If not, the corresponding category group is determined as a file group.

3. The file uploading method according to claim 2, characterized in that: After determining the number of target files based on the vehicle-side browser concurrent request limit, the method further includes: Detect the current network signal on the vehicle side; Determining the current number of files corresponding to the current network signal based on a preset relationship, wherein the preset relationship is a mapping relationship between different signal strength intervals and the number of files; When the current number of files is less than the target number of files, the target number of files is updated, and the current number of files is used as the updated target number of files.

4. The file uploading method according to claim 1, characterized in that: The file to be uploaded is sliced ​​to obtain multiple small files, including: Determine the file size of the file to be uploaded; Determine the slice size based on a preset upload rate; Determining the number of slices based on the file size and the slice size; The file to be uploaded is segmented based on the number of slices to obtain multiple small files.

5. The file uploading method according to claim 1, characterized in that: The above will upload all the file groups, including: Each file group is uploaded sequentially using serial communication.

6. The file uploading method according to claim 1, characterized in that: The selection result includes files of different formats, and in response to the selection operation of the user on the vehicle-side browser, the file to be uploaded is determined based on the selection result, including: Detecting whether there is a file upload signal on the vehicle side, wherein the file upload signal is generated by the vehicle side in response to a user selecting a file to be uploaded on a browser on the vehicle side; If it exists, obtain the corresponding file and determine that the file is the file to be uploaded; If not, return to the step of detecting whether there is a file upload signal on the vehicle side.

7. The file uploading method according to claim 6, characterized in that: Before determining that the file is a file to be uploaded, the method further includes: Determine whether the format corresponding to the file meets the preset standard format; If yes, then executing the step of determining that the file is a file to be uploaded; If not, the process returns to the step of determining the file to be uploaded based on the selection result in response to the user's selection operation on the vehicle-side browser.

8. A file upload system, applied to a vehicle, characterized in that: The system comprises: A response module, used to determine the file to be uploaded based on the selection result in response to the selection operation of the user on the browser of the vehicle end; A slicing module, used to slice the file to be uploaded into multiple small files; A grouping module is used to group all small files based on file attributes, browser attributes and vehicle-side network status to obtain multiple file groups; The upload module is used to upload all file groups.

9. A vehicle, characterized in that: The vehicle includes a controller, and the controller includes: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the file uploading method described in any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the file uploading method according to any one of claims 1 to 7.