CN106657197B - File uploading method and device - Google Patents

File uploading method and device Download PDF

Info

Publication number
CN106657197B
CN106657197B CN201510736058.7A CN201510736058A CN106657197B CN 106657197 B CN106657197 B CN 106657197B CN 201510736058 A CN201510736058 A CN 201510736058A CN 106657197 B CN106657197 B CN 106657197B
Authority
CN
China
Prior art keywords
uploaded
data blocks
file
data block
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510736058.7A
Other languages
Chinese (zh)
Other versions
CN106657197A (en
Inventor
于小军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201510736058.7A priority Critical patent/CN106657197B/en
Publication of CN106657197A publication Critical patent/CN106657197A/en
Application granted granted Critical
Publication of CN106657197B publication Critical patent/CN106657197B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Abstract

The invention discloses a method and a device for uploading files. Wherein, the method comprises the following steps: acquiring a received file to be uploaded; judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value; if the data capacity of the file to be uploaded is larger than the capacity threshold value, dividing the file to be uploaded into a plurality of data blocks; and uploading the plurality of divided data blocks to a server in parallel. By adopting the embodiment, the problem of low speed when the file is uploaded at the front end of the web in the prior art is solved, and the effect of quickly uploading the large file on the web page is realized.

Description

File uploading method and device
Technical Field
The invention relates to the field of internet, in particular to a method and a device for uploading files.
Background
At present, the main solution for uploading files at the front end of the Web is as follows:
uploading by a form in a browser default mode: after determining the files needing to be uploaded through the form, sequentially reading the files needing to be uploaded, and serially uploading the files needing to be uploaded from the beginning to the end of the files in a streaming uploading mode.
For uploading small files, uploading in form is enough, but for large files, the streaming uploading speed is too slow to meet the requirement of fast uploading.
Aiming at the problem of low speed when the file is uploaded at the front end of the web, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides a method and a device for uploading files, which at least solve the technical problem of low speed when the files are uploaded at a web front end.
According to an aspect of an embodiment of the present invention, there is provided a method for uploading a file, the method including: acquiring a received file to be uploaded; judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value; if the data capacity of the file to be uploaded is larger than the capacity threshold value, dividing the file to be uploaded into a plurality of data blocks; and uploading the plurality of divided data blocks to a server in parallel.
According to another aspect of the embodiments of the present invention, there is also provided an apparatus for uploading a file, the apparatus including: the acquisition unit is used for acquiring the received file to be uploaded; the judging unit is used for judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value or not; the dividing unit is used for dividing the file to be uploaded into a plurality of data blocks if the data capacity of the file to be uploaded is larger than the capacity threshold; and the uploading unit is used for uploading the plurality of data blocks obtained by division to a server in parallel.
By adopting the embodiment, when the data capacity (namely the size of the data) of the file to be uploaded is larger than the capacity threshold value, namely the file to be uploaded is a large file, the file to be uploaded is divided into the data blocks, and the data blocks are uploaded to the server in parallel.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is an environmental schematic of a terminal according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of uploading files according to an embodiment of the invention;
FIG. 3 is a flow diagram of an alternative method of file upload according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a transmission sequence according to an embodiment of the present invention;
FIG. 5 is a diagram of an alternative data block selection window according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a second alternative data block selection window according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a third alternative data block selection window according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating a fourth alternative data block selection window according to an embodiment of the present invention;
FIG. 9 is a flow diagram of an alternative method of file upload according to an embodiment of the present invention;
fig. 10 is a flowchart of an apparatus for file upload according to an embodiment of the present invention;
fig. 11 is a block diagram of a computer terminal according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
In accordance with an embodiment of the present invention, there is provided an embodiment of a method for file upload, it being noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer executable instructions and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that described herein.
Alternatively, in this embodiment, the method for uploading the file may be applied to a hardware environment formed by the terminal 10 and the server 30 shown in fig. 1, and the terminal may establish a connection with the server through a network. Wherein, the terminal and the server can be provided with a processor.
Such networks include, but are not limited to: a wide area network, a metropolitan area network, or a local area network. Preferably, the network is a local area network.
The terminal can be a personal computer, a mobile terminal and an intelligent terminal, for example, the terminal can be a smart phone, a PDA, a tablet computer and the like.
According to an embodiment of the present invention, a method for uploading a file is provided, as shown in fig. 2, the method may include the following steps:
step S202: acquiring a received file to be uploaded;
step S204: judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value or not;
step S206: if the data capacity of the file to be uploaded is larger than a capacity threshold value, dividing the file to be uploaded into a plurality of data blocks;
step S208: and uploading the plurality of divided data blocks to a server in parallel.
By adopting the embodiment, when the data capacity (namely the size of data) of the file to be uploaded on the web page is larger than the capacity threshold value, namely the file to be uploaded is a large file, the file to be uploaded is divided into the data blocks, and the data blocks are uploaded to the server in parallel.
Step S202 in the above embodiment may acquire the received file to be uploaded through a web page.
The data capacity in the above embodiment is: the size of the data.
In an alternative embodiment, the capacity threshold in the above embodiments may be set as a fixed threshold, the fixed threshold may be a preset capacity threshold, and the fixed threshold may correspond to a file format of a file to be uploaded, for example, the fixed thresholds set for the video file and the text file may be different.
In another optional embodiment, the threshold value is dynamically adjusted according to the uploading adjustment parameter; or, the uploading adjustment parameter includes at least one of a current network state, an uploading time period and a file format to be uploaded.
The transmission efficiency can be further improved by dynamically adjusting the capacity threshold according to different uploading adjustment parameters. For example, the dynamic threshold dynamically adjusted based on the current network state can avoid the problem of low transmission efficiency caused by data division according to the fixed threshold under the extremely poor network condition.
Specifically, a user can select a file to be uploaded at the front end of the web through a form or other selection modes, after a terminal where the web page is located obtains the file to be uploaded received through the web page, the size of the file to be uploaded is obtained, whether the data capacity of the file to be uploaded is larger than a capacity threshold value is judged, if the data capacity of the file to be uploaded is larger than the capacity threshold value, the file to be uploaded is divided into a plurality of data blocks, and the divided data blocks are uploaded to a server in parallel. Alternatively, the capacity threshold may be a fixed 20M, or may be dynamically adjusted according to the upload adjustment parameter.
Optionally, if the data capacity of the file to be uploaded is not greater than the capacity threshold, the file to be uploaded may be uploaded in a default uploading manner of the web page, for example, in a serial manner, or through an API (application programming interface) set by HTML.
As shown in fig. 3, this embodiment can be implemented by the following steps:
step S302: and the user selects the file to be uploaded which needs to be uploaded through the web page.
The user can enter a file list of the terminal where the web page is located through buttons of 'browse' or 'select file' of the web page and the like, select a file to be uploaded from the file list, and display attribute information (such as attribute information of name, size and the like) of the file to be uploaded on the web page of the terminal.
Step S304: the web page obtains the size of the file to be uploaded.
Step S306: and judging whether the file to be uploaded is a large file.
Specifically, the method can be realized by judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value; if the data capacity of the file to be uploaded is greater than the capacity threshold, determining that the file to be uploaded is a large file, and executing step S310; if the data volume of the file to be uploaded is not greater than the volume threshold, it is determined that the file to be uploaded is not a large file, and step S308 is executed.
Step S308: and uploading the file according to the default mode of the web page.
The default mode may be serial upload or upload through an API interface.
Step S310: and dividing the file to be uploaded into a plurality of data blocks.
Step S312: and uploading the plurality of divided data blocks to a server in parallel.
The implementation manners of step S308 and step S310 are the same as the implementation manners of step S206 and step S208 in the above embodiments, and are not described herein again.
In the above embodiment of the present invention, dividing the file to be uploaded into a plurality of data blocks may include: partitioning files to be uploaded according to a preset number of parts to obtain data blocks of the preset number of parts; or partitioning the file to be uploaded according to the preset data capacity to obtain a plurality of data blocks.
Alternatively, when the file to be uploaded is divided, the data capacity of the divided data blocks may be equal or unequal. Specifically, the file to be uploaded can be divided into a fixed number of data blocks, for example, the file to be uploaded can be divided into 512 fixed data blocks, and if the file to be uploaded is divided by the scheme, the size of each divided data block can be smaller than a preset threshold (optionally, the preset threshold can be 8M); the file to be uploaded may also be divided into a plurality of data blocks according to a fixed size, for example, the file to be uploaded is divided according to a division manner of 8M data blocks, for example, the size of the file to be uploaded is 4G, and the file to be uploaded may be divided into 512 data blocks according to the fixed size of 8M (4G/8M is 512).
In the embodiment, after the user selects the large file to be uploaded on the web page, the web page obtains the size of the file to be uploaded, then blocks the file according to the fixed size to obtain a plurality of data blocks, and uploads the data blocks to the server in parallel, so that the uploading speed can be increased in a parallel uploading manner.
According to the above embodiment of the present invention, uploading the plurality of partitioned data blocks to the server in parallel may include: setting a number for each data block based on the sequence of the data blocks in the file to be uploaded, and acquiring the sending sequence of the data blocks according to the sequence of the numbers; the method comprises the steps of sequentially determining a plurality of data blocks to be uploaded in a sending sequence from a first data block in the sending sequence through a data block selection window, and uploading the plurality of data blocks to be uploaded to a server in parallel after the plurality of data blocks to be uploaded are determined each time until all the plurality of data blocks are uploaded to the server, wherein the width of the data block selection window is used for representing the number of the data blocks to be uploaded.
The width of the data block selection window can be determined based on the number of data blocks which are allowed to be uploaded simultaneously in each parallel uploading.
Specifically, sequentially determining a plurality of data blocks to be uploaded in a transmission sequence through the data block selection window may include: after N data blocks to be uploaded determined through the current data block selection window are uploaded to a server in parallel, response information returned by the server is received; and if the response information indicates that the server receives M continuous data blocks to be uploaded starting from the first data block to be uploaded in the N data blocks to be uploaded, moving the current data block selection window backwards by the positions of the M data blocks along the sending sequence to determine that the data block in the current data block selection window is the data block to be uploaded next time. Wherein N is a natural number greater than 1, and M is a nonnegative integer less than or equal to N. Alternatively, N may be 4 or 5.
In the above-described embodiment, a number may be set for each data block based on the order of the plurality of data blocks in the file to be uploaded, for example, from 1 to 512. Determining a transmission sequence of the plurality of data blocks according to the sequence from front to back, wherein the data blocks can be represented by numbers in the transmission sequence. And sequentially determining a plurality of data blocks to be uploaded in the sending sequence through a data block selection window from the first data block in the sending sequence, and uploading the plurality of data blocks to be uploaded to the server in parallel after determining the plurality of data blocks to be uploaded each time until the plurality of data blocks are sent to the server.
Specifically, after four to-be-uploaded data blocks determined by the current data block selection window are uploaded to the server in parallel, response information returned by the server is received, and if the to-be-uploaded data blocks already sent are less than the maximum number of data blocks allowed to be sent at the same time (corresponding to the width of the data block selection window in the above embodiment), the allowed number of data blocks are sent at the same time immediately.
For example, the maximum number of data blocks allowed to be transmitted simultaneously is 5, after data blocks to be uploaded with numbers 1, 2, 3, 4 and 5 are transmitted simultaneously in parallel, response information of the server is received, and if the response information shows that: data block 2 receives the acknowledgement, then data block number 4 receives the acknowledgement, then data block number 1 receives the acknowledgement. After the data block with the number 1 receives the response, the data blocks with the numbers 2 and 4 already receive the response, and the data blocks with the numbers 3 and 5 do not receive the response, because the maximum 5 data blocks are allowed to be simultaneously transmitted, the data blocks with the numbers 6 and 7 can be immediately transmitted after the data blocks with the numbers 1 and 2 have already been received.
The above embodiments are described in detail below with reference to fig. 4 to 8.
It should be noted that the filled boxes in fig. 5 to 8 are data blocks that have been sent and have received responses; the shaded boxes in the figure are data blocks that have been transmitted but have not received a reply, and the blank boxes are data blocks that have not been transmitted.
As shown in fig. 4, numbers from 1 to 12 may be set for each data block based on the order of the data blocks in the file to be uploaded (only data blocks numbered 4, 6, and 8 are labeled in fig. 4, but each number in the figure represents a data block), a transmission sequence of the data blocks is determined in the order of numbers from front to back, and fig. 4 shows an alternative representation of the transmission sequence, where each number in the transmission sequence represents a corresponding data block. Starting from the first data block (for example, the data block numbered 1 in fig. 4) in the transmission sequence, sequentially determining a plurality of data blocks to be uploaded in the transmission sequence through the data block selection window, and uploading the plurality of data blocks to be uploaded to the server in parallel after determining the plurality of data to be uploaded each time.
As shown in fig. 5, if the width of the data block selection window is 4 (i.e. the number of data blocks allowed to be transmitted at the same time is 4), the data block to be uploaded is determined from the data block numbered 1 in the transmission sequence, the data block to be uploaded for the first time is determined to be the data block numbered 1-4 through the data block selection window, and if the data blocks numbered 1, 2, 3 and 4 have been transmitted and have received a response (in this case, N is 4 and M is 4), the data block selection window slides backwards (to the right) by the position of four data blocks, that is, the data block to be uploaded in the current data block selection window is numbered 5-8, the data blocks numbered 5-8 are uploaded to the server in parallel, and the response information indicates that the server receives the data blocks numbered 6 and 7. The server can generate a response signal after receiving a data block to be uploaded, the response signal carries the number of the received data block to be uploaded to indicate that the server receives the numbered data block to be uploaded, and the response information comprises one or more response signals.
As shown in fig. 6, after receiving the response signal of the data block numbered 5, since the data blocks numbered 6 and 7 have already received the response signal, that is, at this time, the server receives 3 consecutive data blocks to be uploaded starting from the first data block in the four data blocks to be uploaded (at this time, N is 4, and M is 3), the current data block selection window slides to the right (back) by the positions of the 3 data blocks (corresponding to 3 cells in the transmission sequence), and then the next multiple data to be uploaded transmitted in parallel are multiple data in the current data block selection window: the data blocks numbered 8-11 are transmitted in parallel at the same time as the data block numbered 8 is already transmitted, the data blocks numbered 9, 10, 11.
As shown in fig. 7, after receiving the response signal of the data block numbered 10, since the data block numbered 8 does not respond, that is, the server determined by the response information receives zero consecutive data blocks to be uploaded from the first data block in the four (8-11) data blocks to be uploaded (in this embodiment, N is 4, and M is 0), the data block selection window no longer slides to the right, and no data block is transmitted.
As shown in fig. 8, after receiving the data block response with the number of 8, the server identified by the response information receives 1 consecutive data block to be uploaded from the first data block of the four (8-11) data blocks to be uploaded (in this case, N is 4, and M is 1), the current data block selection window slides to the right by 1 cell, and the data block with the number of 12 is transmitted.
In the above embodiment, a plurality of data blocks to be uploaded are sequentially determined through the data block selection window, and after a plurality of data blocks to be uploaded are determined each time, the plurality of data blocks to be uploaded are sent in parallel until the front end sends all the data blocks, and after the front end receives all the data block responses of the background, the data can be considered to have been sent.
Optionally, before sequentially determining the data blocks to be uploaded in the transmission sequence through the data block selection window, the width of the data block selection window may be dynamically adjusted according to the acknowledgement information, where the acknowledgement information includes: the server generates an adjustment instruction based on the cache capacity and/or the network congestion parameter, and/or an adjustment instruction generated by the terminal for receiving the file to be uploaded.
In the above embodiment of the present invention, while uploading a plurality of data blocks to be uploaded to a server in parallel, the method may further include: and simultaneously sending the serial numbers of the data blocks to be uploaded to the server.
After uploading the plurality of data blocks to be uploaded to the server in parallel, the method may further include: the server receives a plurality of data blocks to be uploaded in parallel; after each data block to be uploaded is received, generating a response signal of the data block to be uploaded, and sending the response signal to a terminal for receiving a file to be uploaded, wherein the response signal carries the number of the data block to be uploaded and is used for indicating a server to receive the numbered data block to be uploaded; and writing the received data block to be uploaded into a target file.
The terminal for receiving the file to be uploaded in the above embodiment of the present application may be a terminal where a web page is located.
Specifically, writing the received data block to be uploaded into the target file may include: judging whether all data blocks with numbers before the data blocks to be uploaded are received; if all data blocks with numbers before the data blocks to be uploaded are received, writing the data blocks to be uploaded into a target file; and if all the data blocks with the numbers before the data blocks to be uploaded are not received, caching the data blocks to be uploaded, and writing the data blocks to be uploaded into the target file after all the data blocks with the numbers before the data blocks to be uploaded are received.
Optionally, the above embodiment may be implemented by the following steps: judging whether all data blocks with numbers before the received data blocks to be uploaded are received or not; if all data blocks with numbers before the received data block to be uploaded are received, writing the data block to be uploaded and the received data block to be uploaded with continuous numbers starting from the received data block to be uploaded into a target file; if all data blocks with numbers before the received data blocks to be uploaded are not received, caching the data blocks to be uploaded, and after all the data blocks with numbers before the received data blocks to be uploaded are received, writing the received data blocks to be uploaded and the received data blocks to be uploaded with continuous numbers starting from the received data blocks to be uploaded into a target file.
According to the above embodiment of the present invention, after the data blocks are obtained by splitting, the web front end numbers each data block in order, for example: from 1 to 512. After determining the sending sequence according to the sequence of the numbers, the plurality of data blocks are sent to the server in parallel according to the scheme in the above embodiment, and each time one data block is sent, the number of the data block is sent to the server at the same time. The server receives the data blocks in parallel, and immediately returns a response signal to the web front end after receiving each data block, wherein the response parameter of the response signal contains the number of the received data block, if the data block (the number is smaller than the number of the currently received data block) in front of the currently received data block is received in sequence, that is, the data block and the received data blocks with continuous numbers are written into a target file together, for example, the data blocks with the numbers 3, 4 and 6 are received, at this time, after receiving the data block with the number 2, the data with the numbers 2, 3 and 4 are written into the file, and after receiving the data block with the number 5, such as the data block with the number 6, the data block with the number 5 is written into the file together; otherwise, the data block is cached, and the data blocks are written into the target file together after all the previous data blocks are received.
In the above embodiment, after the front end receives the response signal from the server, the number in the response signal is obtained, if the data blocks before the number have all received the response, the calculation is started from the next number of the number, and if the data blocks that have been transmitted are less than the maximum number of data blocks that are allowed to be transmitted at the same time, the allowed number of data blocks are transmitted at the same time immediately.
The above embodiment of the present invention is described in detail with reference to the timing chart of fig. 9, and as shown in fig. 9, the embodiment can be implemented by the following steps:
step S901: and the user selects the file to be uploaded through the front end where the web page is located.
Step S902: and acquiring the size of the file to be uploaded.
Step S903: and judging whether the file to be uploaded is a large file.
If the file to be uploaded is a large file, executing step S904; if the file to be uploaded is not a large file, step S905 is executed.
Step S904: and uploading the file to be uploaded in a default mode.
Alternatively, uploading may be by serial means or uploading through an API interface.
Step S906: and the server receives the file to be uploaded and generates response information.
The response information is used for indicating the server to receive the file to be uploaded.
The terminal receives the response information through step S914, and the web front end receives the completion of the uploading of the response information.
Step S905: and dividing the file to be uploaded into a plurality of data blocks.
Step S907: and determining a plurality of data blocks to be uploaded through the data block selection window.
Step S908: and sending the data blocks to be uploaded to a server.
Step S909: and the server receives the data blocks to be uploaded in parallel.
After the server receives the plurality of data blocks to be uploaded, steps S910 to S914 are executed:
step S910: and acquiring the number of the received data block to be uploaded, and generating a response signal of the received data block to be uploaded.
Step S911: the reply signal is returned to the web front end (i.e., the terminal described above).
Step S912: and judging whether all data blocks with numbers before the received data block to be uploaded are received.
If yes, go to step S913; if not, the process returns to step S912 until all data blocks with numbers before the received data block to be uploaded are received.
Step S913: and writing the data block and the received data blocks with continuous numbers into a target file.
In this embodiment, after the server returns the response signal to the web front end (i.e., the above-described terminal), the terminal performs step S915: and receiving the response information, and returning to execute the step S907 until the uploading of the plurality of data blocks is completed.
The data blocks to be uploaded determined from the second time to the P time can be simultaneously determined through the response information and the data block selection window, and P is a natural number which is greater than or equal to 2.
In the above embodiment, the uploading speed may be increased by uploading files in parallel.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
According to an embodiment of the present invention, there is also provided a method and an apparatus for implementing the file upload, as shown in fig. 10, the apparatus includes:
the acquiring unit 20 is configured to acquire a received file to be uploaded; optionally, the file to be uploaded can be acquired through a web page.
And the judging unit 40 is used for judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value.
The dividing unit 60 is configured to divide the file to be uploaded into a plurality of data blocks if the data capacity of the file to be uploaded is greater than the capacity threshold.
And an uploading unit 80, configured to upload the multiple divided data blocks to the server in parallel.
By adopting the embodiment, when the data capacity (namely the size of the data) of the file to be uploaded is larger than the capacity threshold value, namely the file to be uploaded is a large file, the file to be uploaded is divided into the plurality of data blocks through the dividing unit and the uploading unit, and the plurality of data blocks are uploaded to the server in parallel.
The data capacity in the above embodiment is: the size of the data.
In an alternative embodiment, the capacity threshold in the above embodiments may be set as a fixed threshold, the fixed threshold may be a preset capacity threshold, and the fixed threshold may correspond to a file format of a file to be uploaded, for example, the fixed thresholds set for the video file and the text file may be different.
In another optional embodiment, the threshold value is dynamically adjusted according to the uploading adjustment parameter; or, the uploading adjustment parameter includes at least one of a current network state, an uploading time period and a file format to be uploaded.
The transmission efficiency can be further improved by dynamically adjusting the capacity threshold according to different uploading adjustment parameters. For example, the dynamic threshold dynamically adjusted based on the current network state can avoid the problem of low transmission efficiency caused by data division according to the fixed threshold under the extremely poor network condition.
Specifically, a user selects a file to be uploaded at the front end of a web through a form or other selection modes, acquires the size of the file to be uploaded after a terminal for receiving the file to be uploaded acquires the file to be uploaded received through a web page, then judges whether the data capacity of the file to be uploaded is greater than a capacity threshold, if the data capacity of the file to be uploaded is greater than the capacity threshold, segments the file to be uploaded into a plurality of data blocks, and uploads the segmented data blocks to a server in parallel. Alternatively, the capacity threshold may be a fixed 20M, or may be dynamically adjusted according to the upload adjustment parameter.
Optionally, if the data capacity of the file to be uploaded is not greater than the capacity threshold, the file to be uploaded may be uploaded in a default uploading manner of the web page, for example, in a serial manner, or through an API (application programming interface) set by HTML.
In the above embodiments of the present invention, the dividing unit includes: the first segmentation module is used for segmenting the file to be uploaded according to the preset number of copies to obtain the preset number of data blocks; or the second segmentation module is used for segmenting the file to be uploaded according to the preset data capacity to obtain a plurality of data blocks.
Specifically, after a user selects a large file to be uploaded on a web page, the web page obtains the size of the file to be uploaded, blocks the file according to a fixed size to obtain a plurality of data blocks, and uploads the data blocks to a server in parallel, so that the uploading speed can be increased in a parallel uploading mode.
According to the above embodiment of the present invention, the uploading unit may include: the setting module is used for setting a number for each data block based on the sequence of the data blocks in the file to be uploaded and acquiring the sending sequence of the data blocks according to the sequence of the numbers; the processing module is used for sequentially determining a plurality of data blocks to be uploaded in the sending sequence from a first data block in the sending sequence through a data block selection window, and uploading the plurality of data blocks to be uploaded to the server in parallel after the plurality of data blocks to be uploaded are determined each time until all the plurality of data blocks are uploaded to the server, wherein the width of the data block selection window is used for representing the number of the data blocks to be uploaded.
The width of the data block selection window can be determined based on the number of data blocks which are allowed to be uploaded simultaneously in each parallel uploading.
Specifically, the processing module includes: the receiving submodule is used for receiving response information of the N data blocks to be uploaded, which is returned by the server, after the N data blocks to be uploaded, which are determined through the current data block selection window, are uploaded to the server in parallel; and the determining submodule is used for moving the current data block selection window backwards by the positions of the M data blocks along the sending sequence if response information of M continuous data blocks to be uploaded starting from the first data block to be uploaded in the N data blocks to be uploaded is received, so as to determine that the data block in the current data block selection window is the data block to be uploaded next time, wherein N is a natural number greater than 1, and M is a non-negative integer less than or equal to N.
In the above-described embodiment, a number may be set for each data block based on the order of the plurality of data blocks in the file to be uploaded, for example, from 1 to 512. Determining a transmission sequence of the plurality of data blocks according to the sequence from front to back, wherein the data blocks can be represented by numbers in the transmission sequence. And sequentially determining a plurality of data blocks to be uploaded in the sending sequence through a data block selection window from the first data block in the sending sequence, and uploading the plurality of data blocks to be uploaded to the server in parallel after determining the plurality of data blocks to be uploaded each time until the plurality of data blocks are sent to the server.
Specifically, after four to-be-uploaded data blocks determined by the current data block selection window are uploaded to the server in parallel, response information returned by the server is received, and if the to-be-uploaded data blocks already sent are less than the maximum number of data blocks allowed to be sent at the same time (corresponding to the width of the data block selection window in the above embodiment), the allowed number of data blocks are sent at the same time immediately.
In the above embodiment, a plurality of data blocks to be uploaded are sequentially determined through the data block selection window, and after a plurality of data blocks to be uploaded are determined each time, the plurality of data blocks to be uploaded are sent in parallel until the front end sends all the data blocks, and after the front end receives all the data block responses of the background, the data can be considered to have been sent.
Optionally, the apparatus further comprises: an adjusting unit, configured to dynamically adjust the width of a data block selection window according to acknowledgement information before sequentially determining, through the data block selection window, a data block to be uploaded in a transmission sequence, where the acknowledgement information includes: the server generates an adjustment instruction based on the cache capacity and/or the network congestion parameter, and/or an adjustment instruction generated by the terminal for receiving the file to be uploaded.
According to the above embodiment of the present invention, the processing module further includes: and the simultaneous uploading submodule is used for simultaneously transmitting the serial numbers of the data blocks to be uploaded to the server while parallelly uploading the data blocks to be uploaded to the server.
Optionally, the apparatus may further comprise: the receiving unit is used for parallelly receiving the data blocks to be uploaded by the server after the data blocks to be uploaded are parallelly uploaded to the server; the signal processing unit is used for generating a response signal of each data block to be uploaded after each data block to be uploaded is received, and sending the response signal to a terminal for receiving a file to be uploaded, wherein the response signal carries the number of the data block to be uploaded, and the response signal is used for indicating a server to receive the numbered data block to be uploaded; and the writing unit is used for writing the received data block to be uploaded into the target file.
Specifically, the writing unit includes: the judging module is used for judging whether all data blocks with numbers before the data blocks to be uploaded are received; the first writing module is used for writing the data blocks to be uploaded into the target file if all the data blocks with the serial numbers before the data blocks to be uploaded are received; and the second writing module is used for caching the data block to be uploaded if all the data blocks with the numbers before the data block to be uploaded are not received, and writing the data block to be uploaded into the target file after all the data blocks with the numbers before the data block to be uploaded are received.
In the above embodiment, the uploading speed may be increased by uploading files in parallel.
Each module provided in this embodiment is the same as the use method provided in the corresponding step of the method embodiment, and the application scenario may also be the same. Of course, it should be noted that the solution related to the modules may not be limited to the content and the scenario in the above embodiments, and the modules may be executed in a computer terminal or a mobile terminal, and may be implemented by software or hardware.
Example 3
Embodiments of the present application may provide a computer terminal, where the computer terminal may be any one computer terminal device in a computer terminal group, and the terminal may be configured to execute the method for uploading a file in the foregoing embodiments of the present application. Optionally, in this embodiment, the computer terminal may also be replaced with a terminal device such as a mobile terminal. The computer terminal may be the touch screen device, and the touch screen device may be a personal computer or a mobile terminal.
Optionally, in this embodiment, the computer terminal may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, fig. 11 is a block diagram of a computer terminal according to an embodiment of the present application. As shown in fig. 11, the computer terminal may include: one or more (only one shown) processors 101, memory 103, transmission means 105, and input-output devices 107.
The memory 103 may be configured to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for uploading a file in the embodiment of the present application, and the processor 101 executes various functional applications and data processing by executing the software programs and modules stored in the memory 103, that is, implementing the above-mentioned method for uploading a file. The memory 103 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 103 may further include memory located remotely from the processor 101, which may be connected to the terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 105 is used to receive or transmit data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 105 includes a Network adapter (NIC) that can be connected to a router via a Network cable and other Network devices to communicate with the internet or a local area Network. In one example, the transmission device 105 is a Radio Frequency (RF) module, which is used to communicate with the internet by wireless means.
Among them, the memory 103 is used for operation information of a method of file upload, and an application program set thereon, in particular.
The processor 101 may call the information and application stored in the memory 103 through the transmission device to perform the following steps: acquiring a received file to be uploaded; judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value or not; if the data capacity of the file to be uploaded is larger than a capacity threshold value, dividing the file to be uploaded into a plurality of data blocks; and uploading the plurality of divided data blocks to a server in parallel.
Optionally, the processor 101 may further perform the following steps: setting a number for each data block based on the sequence of the data blocks in the file to be uploaded, and acquiring the sending sequence of the data blocks according to the sequence of the numbers; the method comprises the steps of sequentially determining a plurality of data blocks to be uploaded in a sending sequence from a first data block in the sending sequence through a data block selection window, and uploading the plurality of data blocks to be uploaded to a server in parallel after the plurality of data blocks to be uploaded are determined each time until all the plurality of data blocks are uploaded to the server, wherein the width of the data block selection window is used for representing the number of the data blocks to be uploaded.
Optionally, the processor 101 may further perform the following steps: after N data blocks to be uploaded determined through the current data block selection window are uploaded to a server in parallel, response information returned by the server is received; and if the response information indicates that the server receives M continuous data blocks to be uploaded starting from the first data block to be uploaded in the N data blocks to be uploaded, moving the current data block selection window backwards by the positions of the M data blocks along the transmission sequence to determine that the data blocks in the current data block selection window are the data blocks to be uploaded next time, wherein N is a natural number greater than 1, and M is a non-negative integer less than or equal to N.
Optionally, the processor 101 may further perform the following steps: when a plurality of data blocks to be uploaded are uploaded to the server in parallel, the method further comprises the following steps: and simultaneously sending the serial numbers of the data blocks to be uploaded to the server. After uploading the plurality of data blocks to be uploaded to the server in parallel, the method further comprises: the server receives a plurality of data blocks to be uploaded in parallel; after each data block to be uploaded is received, generating a response signal of the data block to be uploaded, and sending the response signal to a terminal for receiving a file to be uploaded, wherein the response signal carries the number of the data block to be uploaded and is used for indicating a server to receive the numbered data block to be uploaded; and writing the received data block to be uploaded into a target file.
Optionally, the processor 101 may further perform the following steps: judging whether all data blocks with numbers before the data blocks to be uploaded are received; if all data blocks with numbers before the data blocks to be uploaded are received, writing the data blocks to be uploaded into a target file; and if all the data blocks with the numbers before the data blocks to be uploaded are not received, caching the data blocks to be uploaded, and writing the data blocks to be uploaded into the target file after all the data blocks with the numbers before the data blocks to be uploaded are received.
By adopting the embodiment, when the data capacity (namely the size of the data) of the file to be uploaded is larger than the capacity threshold value, namely the file to be uploaded is a large file, the file to be uploaded is divided into the data blocks, and the data blocks are uploaded to the server in parallel.
It can be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration, and the computer terminal may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 11 is a diagram illustrating a structure of the electronic device. For example, computer terminal 17 may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Example 4
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the file uploading method provided in the foregoing embodiment.
Optionally, in this embodiment, the storage medium 902 may be located in at least one of a plurality of network devices in the network.
Optionally, in this embodiment, the storage medium 902 is configured to store program code for performing the following steps: acquiring a received file to be uploaded; judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value or not; if the data capacity of the file to be uploaded is larger than a capacity threshold value, dividing the file to be uploaded into a plurality of data blocks; and uploading the plurality of divided data blocks to a server in parallel.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
setting a number for each data block based on the sequence of the data blocks in the file to be uploaded, and acquiring the sending sequence of the data blocks according to the sequence of the numbers; the method comprises the steps of sequentially determining a plurality of data blocks to be uploaded in a sending sequence from a first data block in the sending sequence through a data block selection window, and uploading the plurality of data blocks to be uploaded to a server in parallel after the plurality of data blocks to be uploaded are determined each time until all the plurality of data blocks are uploaded to the server, wherein the width of the data block selection window is used for representing the number of the data blocks to be uploaded.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
after N data blocks to be uploaded determined through the current data block selection window are uploaded to a server in parallel, response information returned by the server is received; and if the response information indicates that the server receives M continuous data blocks to be uploaded starting from the first data block to be uploaded in the N data blocks to be uploaded, moving the current data block selection window backwards by the positions of the M data blocks along the transmission sequence to determine that the data blocks in the current data block selection window are the data blocks to be uploaded next time, wherein N is a natural number greater than 1, and M is a non-negative integer less than or equal to N.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
when a plurality of data blocks to be uploaded are uploaded to the server in parallel, the method further comprises the following steps: and simultaneously sending the serial numbers of the data blocks to be uploaded to the server. After uploading the plurality of data blocks to be uploaded to the server in parallel, the method further comprises: the server receives a plurality of data blocks to be uploaded in parallel; after each data block to be uploaded is received, generating a response signal of the data block to be uploaded, and sending the response signal to a terminal for receiving a file to be uploaded, wherein the response signal carries the number of the data block to be uploaded and is used for indicating a server to receive the numbered data block to be uploaded; and writing the received data block to be uploaded into a target file.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
judging whether all data blocks with numbers before the data blocks to be uploaded are received; if all data blocks with numbers before the data blocks to be uploaded are received, writing the data blocks to be uploaded into a target file; and if all the data blocks with the numbers before the data blocks to be uploaded are not received, caching the data blocks to be uploaded, and writing the data blocks to be uploaded into the target file after all the data blocks with the numbers before the data blocks to be uploaded are received.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and embodiments, and this embodiment is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (8)

1. A method for uploading a file, comprising:
the method comprises the steps of obtaining a received file to be uploaded, including entering a file list of a terminal where a webpage is located through a button of the webpage, selecting the file to be uploaded from the file list, and displaying attribute information of the file to be uploaded in the webpage when the file to be uploaded is selected, wherein the attribute information includes the name of the file to be uploaded and the size of the file to be uploaded;
judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value, wherein the size of the capacity threshold value is determined according to the current network state, the uploading time period and the format of the file to be uploaded;
if the data capacity of the file to be uploaded is larger than the capacity threshold, dividing the file to be uploaded into a plurality of data blocks, wherein the dividing of the file to be uploaded into the plurality of data blocks comprises dividing the file to be uploaded into the plurality of data blocks according to a preset number of parts to obtain the plurality of data blocks of the preset number of parts;
setting a number for each data block based on the sequence of the data blocks in the file to be uploaded, and acquiring the sending sequence of the data blocks according to the sequence of the numbers; sequentially determining a plurality of data blocks to be uploaded in the sending sequence from a first data block in the sending sequence through a data block selection window, uploading the plurality of data blocks to be uploaded to a server in parallel after the plurality of data blocks to be uploaded are determined each time, determining the width of the data block selection window according to the number of the data blocks which are allowed to be uploaded simultaneously in parallel uploading each time, and receiving response information returned by the server after the N data blocks to be uploaded determined through the current data block selection window are uploaded to the server in parallel; if the response message indicates that the server receives M continuous data blocks to be uploaded starting from the first data block to be uploaded in the N data blocks to be uploaded, the current data block selection window is shifted back by the position of M data blocks along the transmission sequence, determining the data blocks in the current data block selection window as data blocks to be uploaded next time until all the data blocks are uploaded to the server, wherein the width of the data block selection window is used for representing the number of the data blocks to be uploaded, the width of the data block selection window is dynamically adjusted according to an adjustment instruction generated by the server based on cache capacity and/or an adjustment instruction generated by a terminal for receiving the file to be uploaded, wherein N is a natural number greater than 1, and M is a non-negative integer less than or equal to N;
the server is also used for receiving a plurality of data blocks to be uploaded in parallel; after each data block to be uploaded is received, a response signal of the data block to be uploaded is generated, the response signal is sent to a terminal used for receiving a file to be uploaded, the received data block to be uploaded is written into a target file, the response signal carries the number of the data block to be uploaded, and the response signal is used for indicating a server to receive the numbered data block to be uploaded.
2. The method of claim 1,
while the plurality of data blocks to be uploaded are uploaded to the server in parallel, the method further comprises: simultaneously sending the serial numbers of the data blocks to be uploaded to the server;
after the plurality of data blocks to be uploaded are uploaded to the server in parallel, the method further comprises:
the server receives the data blocks to be uploaded in parallel;
after each data block to be uploaded is received, generating a response signal of the data block to be uploaded, and sending the response signal to a terminal for receiving the file to be uploaded, wherein the response signal carries the number of the data block to be uploaded, and the response signal is used for indicating the server to receive the data block to be uploaded with the number;
and writing the received data block to be uploaded into a target file.
3. The method of claim 2, wherein writing the received data block to be uploaded to the target file comprises:
judging whether all data blocks with numbers before the data blocks to be uploaded are received;
if all data blocks with serial numbers before the data block to be uploaded are received, writing the data block to be uploaded into the target file;
if all data blocks with numbers before the data blocks to be uploaded are not received, caching the data blocks to be uploaded, and writing the data blocks to be uploaded into the target file after all data blocks with numbers before the data blocks to be uploaded are received.
4. An apparatus for uploading a document, comprising:
the device comprises an acquisition unit, a processing unit and a display unit, wherein the acquisition unit is used for acquiring a received file to be uploaded, and comprises a file list entering a terminal where a webpage is located through a button of the webpage, selecting the file to be uploaded from the file list, and displaying attribute information of the file to be uploaded in the webpage when the file to be uploaded is selected, wherein the attribute information comprises the name of the file to be uploaded and the size of the file to be uploaded;
the judging unit is used for judging whether the data capacity of the file to be uploaded is larger than a capacity threshold value, wherein the size of the capacity threshold value is determined according to the current network state, the uploading time period and the format of the file to be uploaded;
the file processing device comprises a dividing unit, a first dividing module and a second dividing module, wherein the dividing unit is used for dividing the file to be uploaded into a plurality of data blocks if the data capacity of the file to be uploaded is larger than the capacity threshold, and the first dividing module is used for dividing the file to be uploaded into the plurality of data blocks according to a preset number of copies to obtain the plurality of data blocks of the preset number of copies;
the uploading unit comprises a setting module, a transmitting module and a processing module, wherein the setting module is used for setting a number for each data block based on the sequence of the data blocks in the file to be uploaded and acquiring the transmitting sequence of the data blocks according to the sequence of the numbers; the processing module is used for sequentially determining a plurality of data blocks to be uploaded in the sending sequence from a first data block in the sending sequence through a data block selection window, and uploading the plurality of data blocks to be uploaded to a server in parallel after the plurality of data blocks to be uploaded are determined each time until all the plurality of data blocks are uploaded to the server, and the width of the data block selection window is determined according to the number of data blocks which are allowed to be uploaded simultaneously during each parallel uploading;
wherein the processing module comprises: the receiving submodule is used for receiving response information returned by the server after the N data blocks to be uploaded determined by the current data block selection window are uploaded to the server in parallel; a determining submodule, configured to, if the response information indicates that the server receives M consecutive data blocks to be uploaded starting from a first data block to be uploaded in the N data blocks to be uploaded, move the current data block selection window backward along the transmission sequence by positions of the M data blocks, so as to determine that a data block in the current data block selection window is a data block to be uploaded next time, where a width of the data block selection window is used to indicate the number of the data blocks to be uploaded, and a width of the data block selection window is dynamically adjusted according to an adjustment indication generated by the server based on a cache capacity and/or an adjustment indication generated by a terminal used to receive the file to be uploaded, where N is a natural number greater than 1, and M is a non-negative integer less than or equal to N;
the server is also used for receiving a plurality of data blocks to be uploaded in parallel; after each data block to be uploaded is received, a response signal of the data block to be uploaded is generated, the response signal is sent to a terminal used for receiving a file to be uploaded, the received data block to be uploaded is written into a target file, the response signal carries the number of the data block to be uploaded, and the response signal is used for indicating a server to receive the numbered data block to be uploaded.
5. The apparatus of claim 4,
the processing module further comprises: the simultaneous uploading sub-module is used for simultaneously transmitting the serial numbers of the data blocks to be uploaded to the server while simultaneously uploading the data blocks to be uploaded to the server;
the device further comprises:
the receiving unit is used for receiving the data blocks to be uploaded in parallel by the server after the data blocks to be uploaded are uploaded to the server in parallel;
the signal processing unit is used for generating a response signal of each data block to be uploaded after each data block to be uploaded is received, and sending the response signal to a terminal for receiving the file to be uploaded, wherein the response signal carries the number of the data block to be uploaded, and the response signal is used for indicating the server to receive the data block to be uploaded with the number;
and the writing unit is used for writing the received data block to be uploaded into a target file.
6. The apparatus of claim 5, wherein the write unit comprises:
the judging module is used for judging whether all data blocks with numbers before the data blocks to be uploaded are received;
the first writing module is used for writing the data block to be uploaded into the target file if all data blocks with serial numbers before the data block to be uploaded are received;
and the second writing module is used for caching the data block to be uploaded if all the data blocks with the numbers before the data block to be uploaded are not received, and writing the data block to be uploaded into the target file after all the data blocks with the numbers before the data block to be uploaded are received.
7. A computer-readable storage medium, characterized in that it comprises a stored program, wherein the program is executable by a terminal device or a computer to perform the method of any of claims 1 to 3.
8. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program which, when executed by the processor, implements the method of any of claims 1 to 3.
CN201510736058.7A 2015-11-02 2015-11-02 File uploading method and device Active CN106657197B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510736058.7A CN106657197B (en) 2015-11-02 2015-11-02 File uploading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510736058.7A CN106657197B (en) 2015-11-02 2015-11-02 File uploading method and device

Publications (2)

Publication Number Publication Date
CN106657197A CN106657197A (en) 2017-05-10
CN106657197B true CN106657197B (en) 2021-10-15

Family

ID=58810196

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510736058.7A Active CN106657197B (en) 2015-11-02 2015-11-02 File uploading method and device

Country Status (1)

Country Link
CN (1) CN106657197B (en)

Families Citing this family (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107329966B (en) * 2017-05-11 2020-05-19 昆仑智汇数据科技(北京)有限公司 Machine data storage method and system
CN107231350B (en) * 2017-05-24 2020-05-19 北京潘达互娱科技有限公司 Message processing method and device
CN109088907B (en) * 2017-06-14 2021-10-01 北京京东尚科信息技术有限公司 File transfer method and device
CN108833200A (en) * 2018-05-04 2018-11-16 佛山科学技术学院 A kind of adaptive unidirectional transmission method of large data files and device
CN109743386B (en) * 2018-12-29 2021-11-02 卓米私人有限公司 Session request sending method and device, electronic equipment and storage medium
CN110198349B (en) * 2019-05-27 2022-11-22 腾讯科技(深圳)有限公司 File transmission method and device, storage medium and electronic device
CN110347380B (en) * 2019-07-18 2023-08-29 中国联合网络通信集团有限公司 Front-end and back-end development method and device
CN110543281A (en) * 2019-07-19 2019-12-06 苏州浪潮智能科技有限公司 Storage compression implementation method, device, equipment and storage medium
CN110602163B (en) * 2019-08-07 2022-02-01 创新先进技术有限公司 File uploading method and device
CN110740345A (en) * 2019-09-20 2020-01-31 北京旷视科技有限公司 Offline video file speed doubling analysis method and device
CN111917867A (en) * 2020-07-29 2020-11-10 星辰天合(北京)数据科技有限公司 Method and device for uploading Web file
CN112491990B (en) * 2020-11-17 2021-08-10 中科三清科技有限公司 Hybrid cloud network data transmission method and device, electronic equipment and storage medium
CN112584525B (en) * 2020-12-07 2023-02-03 广州技象科技有限公司 Uplink data segmentation method and device based on multi-user access
CN112671921A (en) * 2020-12-29 2021-04-16 平安普惠企业管理有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN112968958A (en) * 2021-02-19 2021-06-15 携程计算机技术(上海)有限公司 Method, system, device and medium for processing attachment in OTA website
CN115395988A (en) * 2021-05-25 2022-11-25 瑞昱半导体股份有限公司 Bluetooth communication device and data transmission method
CN117459525B (en) * 2023-12-20 2024-04-12 宁德时代新能源科技股份有限公司 File uploading method, device, equipment and medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101719926A (en) * 2009-12-03 2010-06-02 成都耀邦科技有限责任公司 Web service multithreading file uploading system
CN101828372A (en) * 2007-10-10 2010-09-08 甲骨文美国公司 TCP behavior parallelization to the network connection
CN101867617A (en) * 2010-06-13 2010-10-20 优视科技有限公司 File uploading method base on mobile terminal and system and uploading server thereof
CN101980509A (en) * 2010-11-05 2011-02-23 北京云快线软件服务有限公司 File fragment transmission method and device
CN102571788A (en) * 2011-12-30 2012-07-11 北京奇虎科技有限公司 Sample collection method and system
CN103001751A (en) * 2012-12-18 2013-03-27 华中科技大学 Cross-layer ARQ (Automatic Repeat Request) method in LTE-WLAN (Long Term Evolution and Wireless Local Area Network) heterogeneous wireless network system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101656751B (en) * 2008-08-18 2012-05-30 北京数码大方科技有限公司 Method and system for accelerating file uploading and downloading
US20120102154A1 (en) * 2010-10-26 2012-04-26 Futurewei Technologies, Inc. Cloud-Based Transcoding Platform Systems and Methods

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101828372A (en) * 2007-10-10 2010-09-08 甲骨文美国公司 TCP behavior parallelization to the network connection
CN101719926A (en) * 2009-12-03 2010-06-02 成都耀邦科技有限责任公司 Web service multithreading file uploading system
CN101867617A (en) * 2010-06-13 2010-10-20 优视科技有限公司 File uploading method base on mobile terminal and system and uploading server thereof
CN101980509A (en) * 2010-11-05 2011-02-23 北京云快线软件服务有限公司 File fragment transmission method and device
CN102571788A (en) * 2011-12-30 2012-07-11 北京奇虎科技有限公司 Sample collection method and system
CN103001751A (en) * 2012-12-18 2013-03-27 华中科技大学 Cross-layer ARQ (Automatic Repeat Request) method in LTE-WLAN (Long Term Evolution and Wireless Local Area Network) heterogeneous wireless network system

Also Published As

Publication number Publication date
CN106657197A (en) 2017-05-10

Similar Documents

Publication Publication Date Title
CN106657197B (en) File uploading method and device
CN110162726B (en) Page resource loading method and device and storage medium
CN110121098B (en) Video playing method and device, storage medium and electronic device
US10360694B2 (en) Methods and devices for image loading and methods and devices for video playback
CN109996110B (en) Video playing method, terminal, server and storage medium
CN104683458A (en) Wallpaper recommendation method and server
CN105549936B (en) Data table display method and device
CN107295352B (en) Video compression method, device, equipment and storage medium
CN111324275A (en) Broadcasting method and device for elements in display picture
CN110650357B (en) Video decoding method and device
CA2856620A1 (en) Adaptive content delivery
CN113626402A (en) Log data acquisition method and device, electronic equipment and storage medium
CN106502496B (en) Window switching method and device
CN111492408A (en) Cartoon data display system, method, and program
JP6429467B2 (en) Multi-large screen display system, display terminal and distribution server
CN104580672A (en) Information processing method and electronic equipment
CN110324366B (en) Data processing method, device and system
CN110232393B (en) Data processing method and device, storage medium and electronic device
KR101637022B1 (en) Apparatus and method for transmitting and receiving content
CN109361956B (en) Time-based video cropping methods and related products
CN105389313A (en) Photo previewing method and device thereof
CN111246276A (en) Remote courseware playing method and device and electronic equipment
EP3079312B1 (en) Method of service synchronization and sharing and multi-device control in digital home
CN114237402B (en) Virtual reality space movement control system and method
CN108874514B (en) Message processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant