CN101577730A - Method for uploading and downloading files synchronously based on FTP protocol - Google Patents

Method for uploading and downloading files synchronously based on FTP protocol Download PDF

Info

Publication number
CN101577730A
CN101577730A CNA200910076697XA CN200910076697A CN101577730A CN 101577730 A CN101577730 A CN 101577730A CN A200910076697X A CNA200910076697X A CN A200910076697XA CN 200910076697 A CN200910076697 A CN 200910076697A CN 101577730 A CN101577730 A CN 101577730A
Authority
CN
China
Prior art keywords
file
subfile
upload
download
ftp server
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.)
Pending
Application number
CNA200910076697XA
Other languages
Chinese (zh)
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.)
TRANSN (BEIJING) INFORMATION TECHNOLOGY Co Ltd
Original Assignee
TRANSN (BEIJING) INFORMATION TECHNOLOGY 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 TRANSN (BEIJING) INFORMATION TECHNOLOGY Co Ltd filed Critical TRANSN (BEIJING) INFORMATION TECHNOLOGY Co Ltd
Priority to CNA200910076697XA priority Critical patent/CN101577730A/en
Publication of CN101577730A publication Critical patent/CN101577730A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Transfer Between Computers (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to a method for uploading and downloading files synchronously based on an FTP protocol, comprising the following steps of: acquiring compressed files needing to be uploaded; splitting the files into N subfiles, wherein N is more than or equal to 2; uploading the subfiles to an FTP server; downloading the subfiles on the FTP server; and combining all the subfiles into the original compressed files correspondingly. In the uploading process of an uploading end, if one subfile is uploaded successfully, a downloading end can download; and when a larger file is uploaded, the method can save waiting time of the downloading end.

Description

A kind of method that uploads and downloads file synchronously based on File Transfer Protocol
Technical field
The present invention relates to a kind of document transmission method, especially, relate to a kind of method that uploads and downloads file synchronously based on File Transfer Protocol.
Background technology
Along with social science and technology and rapid development of economy, the information exchange of networking has become the part in the life and work, and the most frequently used method of network information exchange will be to transmit these information with file mode, the method of network file transmission has multiple, and wherein modal have the instrument of FTP, the instrument of P2P class or instrument of mail technique or the like.
The instrument of FTP can be with file transfer to a station server, the another one user downloads file get off from server by ftp software more then, and the problem that this process occurs is to have only the user of upload file to upload file to finish, and another one user could download.The main effect of FTP, allowing the user connect a remote computer (moving the ftp server program on these computers) exactly watches remote computer which file is arranged, then file is copied local computer from remote computer, or the file of local computer is delivered to remote computer; The File Transfer Protocol of standard must be finished a file transfer in the process of transfer files, and other clients could be downloaded.
In addition, can finish directly the function of a file transfer to an other station terminal user's the machine for the instrument of P2P class, but this instrument needs two users simultaneously online, and because its transmission course is point-to-point carrying out, therefore do not need server, so there is not the service end record.
How rapidly and synchronous uploading and file in download in a word, the problem that those skilled in the art need solve is exactly, on ftp server,, and can guarantee to reduce the stand-by period of downloading end in upload procedure.
Summary of the invention
The purpose of this invention is to provide and a kind ofly can in upload procedure, reduce the stand-by period of downloading end, and the method that uploads and downloads file synchronously based on File Transfer Protocol with file in download uploaded that can be synchronous.
For achieving the above object, the invention discloses a kind of method that uploads and downloads file synchronously based on File Transfer Protocol, this method comprises:
Obtain the compressed file that to upload;
Splitting described file is N subfile, and wherein N is more than or equal to 2;
Upload described subfile to ftp server;
On ftp server, download described subfile, accordingly all subfiles are combined as former compressed file.
Further, described ftp server setting on computers;
Further, adopt windows RAR to split the compressed file that described needs are uploaded;
The number N of subfile is set accordingly by the value that changes the FsplitSize constant further;
For achieving the above object, the invention also discloses a kind of method based on the upload file of File Transfer Protocol, this method comprises:
Obtain the compressed file that to upload;
Splitting described file is N subfile, and wherein N is more than or equal to 2;
Upload described subfile to ftp server.
For achieving the above object, the invention also discloses a kind of method of the file in download based on File Transfer Protocol, this method comprises:
Obtaining on ftp server needs downloaded files;
Download the subfile of described file correspondence;
The subfile of downloading is combined as former compressed file.
Compared with prior art, the present invention has the following advantages:
When needs transmit a big file by FTP, at first file is compressed, split again, the subfile after transmission splits, thus solved in the big file process of transmission the problem that could download after to be transmitted the finishing such as download side's needs effectively.
Promptly in the present invention with compression function and the combination of fractionation function, the file that needs are uploaded is split as corresponding subfile in compression, and this subfile uploaded synchronously, simultaneously can realize synchronous downloads corresponding subfile at the other end of remote access ftp server, subfile after downloading is made up, and then obtain needed file;
The present invention can realize that a plurality of users download subfile simultaneously, and the number of subfile and size can be set according to the user, fully satisfy user's demand, reduced the stand-by period in synchronous downloading process, realized the quick transmission of file.
Description of drawings
Fig. 1 uploads schematic flow sheet for of the present invention based on the File Transfer Protocol file;
Fig. 2 is the schematic flow sheet of downloading based on the File Transfer Protocol file synchronization of the present invention;
Fig. 3 is for being provided with the schematic diagram of subfile size among a kind of embodiment among the present invention.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
Core idea of the present invention is, be applied in the process of file transfer splitting function, in compressed file, described file is split, in transmission course, realize: in the upload file, the other end at ftp server, a plurality of users download described subfile synchronously, and automatically described subfile are combined as original.
Key step of the present invention is: the first step: obtain the compressed file that need upload;
Second step: splitting described file is N subfile, and wherein N is more than or equal to 2;
The 3rd step: upload described subfile to ftp server; Ftp server is arranged on the local computer or on the remote access computer;
The 4th step: on ftp server, download described subfile, corresponding all subfiles are combined as former compressed file.
Figure 1 shows that and of the present inventionly upload schematic flow sheet that wherein the key step uploaded of file comprises based on the File Transfer Protocol file:
Steps A 1: start the program of uploading;
Steps A 2: create and upload example, or open the example that existing needs are uploaded;
Steps A 3: generate and upload tabulation;
Steps A 4: file verification, the MD5 sign indicating number of the small documents after calculating big file and splitting is promptly got file MD5 and xcopy to temporary folder;
Steps A 5: compressed file; The function of the compressed file that uses in the present embodiment is: (this program is used the Delphi2006 compiling: parameter S ourceFile is source compressed file name, and TargetFile is compression back file destination name; )
// compression function
procedure?TZipper.ExecZipFile(SourceFile:WideString;TargetFile:
WideString);
begin
try
Zipper.FilesList.Add(SourceFile);
Zipper.ZipName:=TargetFile;
Zipper.ReplaceReadOnly:=true;
Zipper.Zip;
except
on?E:Exception?do
begin
FZipResult:=FALSE;
AddLog(E.ClassName+′|′+E.Message);
end;
end;
end;
Steps A 6: split file, the compressed file that adopts windows RAR that described needs are uploaded splits; Certainly, split in the file process, the number N of subfile can be set by the value correspondence that changes the FsplitSize constant, the interface of subfile size is set as shown in Figure 3, i.e. the number of the N that selection needs; Wherein the subfile of Chai Fening is not separated many single compressed packages in the compressed package of same former compressed file;
The function of the fractionation file that corresponding above-mentioned compression function uses in the present embodiment is: (this program is used the Delphi2006 compiling: parameter S ourceFile is source compressed file name, and TargetFile is compression back file destination name; )
// fractionation function
procedure?TSplitter.Execute;
var
FStream,TempStream:TFileStream;
FileNum:Integer;
RestSize,i:Integer;
TempFileName:WideString;
begin
try
FSplitResult:=True;
FStream:=TFileStream.Create(FSrcFile,fmOpenRead);
try
FileNum:=FStream.Size?div?FSplitSize;
RestSize:=FStream.Size-FSplitSize*FileNum;
for?i:=1?to?FileNum?do
begin
if?GlobalInfo.CancelOp?then
Break;
TempFileName:=FTarPath+FSptFileName+IntToStr(i)+FileExt;
TempStream:=TFileStream.Create(TempFileName,fmCreate);
if?FResultList<>nil?then
FResultList.Add(TempFileName);
try
TempStream.CopyFrom(FStream,FSplitSize);
UpdateProgressStatue(FileNum,i);
finally
TempStream.Free;
end;
end;
if0<RestSize?then
begin
TempFileName:=FTarPath+FSptFileName+
IntToStr(FileNum+1)+FileExt;
TempStream:=TFileStream.Create(TempFileName,fmCreate);
if?FResultList<>nil?then
FResultList.Add(TempFileName);
try
TempStream.CopyFrom(FStream,RestSize);
finally
TempStream.Free;
end;
end;
except
on?E:Exception?do
begin
AddLog(E.ClassName+′|′+E.Message);
FStream.Free;
FSplitResult:=False;
Terminate;
end;
end;
FStream.Free;
finally
Terminate;
end;
end;
Steps A 7: visit TPM (service end file process interface) file existence interface generates the subfile tabulation; The access interface at this place mainly is to use for continuous the biography, promptly when bust this or transmission termination, can use the TPM file at this place in continuing the process that passes;
Steps A 8: upload subfile, in this process, if upload failure, retry is three times automatically, if upload still failure for the 4th time, ejects the interface whether prompting retransmits, and the user can select retry or end the transmission of this document; Order according to acquiescence in the upload procedure carries out the transmission of each subfile, perhaps can be selected to upload the order of subfile by user's setting program;
Steps A 9: when single subfile is uploaded successfully, need registration and verification file, promptly visit File manager interface; Work as verification succeeds, promptly execution in step-steps A 10 first subfiles are uploaded success, if check errors, the prompted dialog frame occurs, and the user can select retry, also can end the transmission of this document;
Steps A 10: the program of uploading is promptly visited the TPM interface and is judged whether the file of uploading is the subfile that repeats to transmit by register-file on TPM, if, transmit other subfile again, if not, this document transmission is finished;
Steps A 11: the subfile end of transmission, promptly single is uploaded task and is finished, the user can according to oneself needs deletion temporary file or preserve temporary file, finish the transmission of whole file.
Accordingly, upload the DOC file of a 1G; The first step: upload end and earlier file is compressed (, then no longer carrying out second-compressed) if through being judged as compressed file; Second step: the subfile that again file is split into 1024 1M; The 3rd goes on foot: on by File Transfer Protocol or http protocol file being uploaded onto the server.
Figure 2 shows that the schematic flow sheet of downloading based on the File Transfer Protocol file synchronization of the present invention; This download end can be each user of remote access File Transfer Protocol, or each user of local computer, and its key step of downloading synchronously is as follows:
Step B1: start downloading of FTP;
Step B2: create and download example, exist, directly send COPYDATA message, generate task list if download example;
Step B3: obtain download list, promptly visit TPM file download list interface;
Step B4: the spanned file download list, promptly visit File Manager file existence interface;
Step B5: download subfile; If download the successful execution next step, otherwise acquiescence repeated downloads step 3 is inferior; Whether do not download yet when successful when subfile, point out the interface of retry to eject, the user can select to finish to download or repeated attempt is downloaded the step of subfile;
Step B6: the subfile of downloading is combined as original;
Step B7: the file to combination carries out verification;
Step B8: the original of compression is unziped to temporary folder;
Step B9: xcopy finishes downloading process to destination folder.
Need to prove, in the download subfile process of present embodiment, do not finish, wait the subfile of ftp server to be detected to upload and finish, continue to download if subfile is uploaded.
The invention solves in the file upload procedure, need all upload the problem that just to download after finishing, save the stand-by period of downloading end subscriber greatly; That is to say downloading end judges in the service whether file is arranged, and begins to download, and uploads end and whenever uploads subfile of success, downloads end and just can download immediately, has saved the stand-by period greatly.
Program in the present embodiment is developed with Borland Delphi, and described subfile default settings is 1M, controls the size of subfile in program by the value of control FsplitSize constant.
Above execution mode only is used to illustrate the present invention; and be not limitation of the present invention; the those of ordinary skill in relevant technologies field; under the situation that does not break away from the spirit and scope of the present invention; can also make various variations and modification; therefore all technical schemes that are equal to also belong to category of the present invention, and scope of patent protection of the present invention should be defined by the claims.

Claims (6)

1, a kind of method that uploads and downloads file synchronously based on File Transfer Protocol is characterized in that, comprising:
Obtain the compressed file that to upload;
Splitting described file is N subfile, and wherein N is more than or equal to 2;
Upload described subfile to ftp server;
On ftp server, download described subfile, accordingly all subfiles are combined as former compressed file.
2, the method for claim 1 is characterized in that, described ftp server setting on computers.
3, the method for claim 1 is characterized in that, adopts windows RAR to split the compressed file that described needs are uploaded.
4, method as claimed in claim 3 is characterized in that, the number N of subfile is set accordingly by the value that changes the FsplitSize constant.
5, a kind of method of the upload file based on File Transfer Protocol is characterized in that, comprising:
Obtain the compressed file that to upload;
Splitting described file is N subfile, and wherein N is more than or equal to 2;
Upload described subfile to ftp server.
6, a kind of method of the file in download based on File Transfer Protocol is characterized in that, comprising:
Obtaining on ftp server needs downloaded files;
Download the subfile of described file correspondence;
The subfile of downloading is combined as former compressed file.
CNA200910076697XA 2009-01-15 2009-01-15 Method for uploading and downloading files synchronously based on FTP protocol Pending CN101577730A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNA200910076697XA CN101577730A (en) 2009-01-15 2009-01-15 Method for uploading and downloading files synchronously based on FTP protocol

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNA200910076697XA CN101577730A (en) 2009-01-15 2009-01-15 Method for uploading and downloading files synchronously based on FTP protocol

Publications (1)

Publication Number Publication Date
CN101577730A true CN101577730A (en) 2009-11-11

Family

ID=41272516

Family Applications (1)

Application Number Title Priority Date Filing Date
CNA200910076697XA Pending CN101577730A (en) 2009-01-15 2009-01-15 Method for uploading and downloading files synchronously based on FTP protocol

Country Status (1)

Country Link
CN (1) CN101577730A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722474A (en) * 2012-03-20 2012-10-10 华为终端有限公司 Information processing method and terminal
CN104580285A (en) * 2013-10-15 2015-04-29 镇江雅迅软件有限责任公司 HTTP (hypertext transfer protocol)-based method for realizing continuous file transfer from breakpoints
CN105389391A (en) * 2015-12-18 2016-03-09 天脉聚源(北京)教育科技有限公司 Picture processing method and device
CN107094183A (en) * 2017-06-02 2017-08-25 中国石油大学(华东) A kind of ftp file method for reliable transmission based on port-hopping
CN109831481A (en) * 2018-12-21 2019-05-31 厦门市美亚柏科信息股份有限公司 A kind of method, apparatus and storage medium of big file declustering transmission
CN110855788A (en) * 2019-11-18 2020-02-28 上海新炬网络信息技术股份有限公司 Method for realizing virtual machine template breakpoint resume issuing through proxy

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102722474A (en) * 2012-03-20 2012-10-10 华为终端有限公司 Information processing method and terminal
CN104580285A (en) * 2013-10-15 2015-04-29 镇江雅迅软件有限责任公司 HTTP (hypertext transfer protocol)-based method for realizing continuous file transfer from breakpoints
CN105389391A (en) * 2015-12-18 2016-03-09 天脉聚源(北京)教育科技有限公司 Picture processing method and device
CN105389391B (en) * 2015-12-18 2019-07-26 天脉聚源(北京)教育科技有限公司 A kind of image processing method and device
CN107094183A (en) * 2017-06-02 2017-08-25 中国石油大学(华东) A kind of ftp file method for reliable transmission based on port-hopping
CN107094183B (en) * 2017-06-02 2020-11-06 中国石油大学(华东) FTP file reliable transmission method based on port hopping
CN109831481A (en) * 2018-12-21 2019-05-31 厦门市美亚柏科信息股份有限公司 A kind of method, apparatus and storage medium of big file declustering transmission
CN110855788A (en) * 2019-11-18 2020-02-28 上海新炬网络信息技术股份有限公司 Method for realizing virtual machine template breakpoint resume issuing through proxy

Similar Documents

Publication Publication Date Title
CN108052675A (en) Blog management method, system and computer readable storage medium
WO2014012449A1 (en) Method, device, processing center and system for desktop synchronization
CN101577730A (en) Method for uploading and downloading files synchronously based on FTP protocol
CN103986742B (en) The method and related electronic device of file synchronization
WO2012130036A1 (en) Cross-application network communication method and device
CN101568104A (en) System and method for handshaking between wireless devices and servers
CN103605798B (en) A kind of method for directly operating high in the clouds storage file
CN106936633B (en) Application installation package manufacturing method and server
JP2017107342A (en) Authentication cooperation system, authentication cooperation method, authorization server, application server, and program
MXPA04011432A (en) Application generator.
CN109032663A (en) Generation method, device, computer equipment and the storage medium of interface document
JP2009087361A (en) System and method of creating and communicating with component-based wireless application
CN103634406A (en) File synchronization method and terminal thereof
JP4205323B2 (en) Distribution system, distribution server and distribution method, distribution program
WO2015081908A2 (en) Method, device, and system for updating parameter value
RU2007148280A (en) SYSTEM FOR WEB PUBLICATION
JP2012247927A (en) Screen generation system, screen generation method, and screen generation program
US8789151B2 (en) Remote device communication platform
CN101894059A (en) Method and system for detecting operating condition
CN103049448A (en) File management method and file management system
CN107704550A (en) File migration method, apparatus and computer-readable recording medium
CN104301438A (en) File uploading method
CN106850724A (en) Data push method and device
CN107872492B (en) Method and device for supporting multi-user editing of data object at server
WO2024087767A1 (en) Upgrade installation method and apparatus, system, electronic device, and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20091111