Yi Meng tcp file transfer and Automatic Update system introduction (TCP File transfer) (iii)

Source: Internet
Author: User

Demo Program: HTTP://PAN.BAIDU.COM/S/1GEVFMCR

The idea of file uploading

1. Server-side

A directory is specified in the server-side configuration file, and all files uploaded by the client are saved in this directory.

But the files that come from the client are not saved directly in this directory, but now a subfolder is created in this directory and then saved in a subfolder.

Then the server side to receive the file, you need to know the name of the subfolder, this name is the client when uploading files, the relevant parameters are included.

As an example of this program, the server side specifies that the directory where the files are saved is the D drive. Then all the uploaded files will be saved in the D drive.

Client

The client uploads the file A.rar and tells the server-side A.rar to save it in the 20161201 folder.

The server will create a sub-folder with a name of 20161201 on the D drive, and then save the A.rar in this folder.

The client's code would be roughly the same:

  //gets the local address of the file to be uploaded            stringFilePath = Getfiletoopen ("Uploading Files"); //Create a new file ID            stringFileID =Fileidcreator.getnextfileid (NetworkCommsDotNet.NetworkComms.NetworkIdentifier.ToString ()); //define where the file is stored in the server (relative directory)            stringDestfilepath = "20161201" +@"\"+Path.getfilename (FilePath); //add a file to the file send managerSendfiledict.addsendfile (FileID, FilePath, destfilepath,appoutter.tcpconn);

After the server receives the message, the corresponding subdirectory is created and the file is saved according to the value in the Destfilepath.

qq:286275658

What are the advantages of this form?

In my document system, in this way, only the name of the subfolder is recorded in the fields of the database table.

Of course, subfolders can contain multiple files. For example, a document can contain multiple attachments.

Client, you can get all the files in this folder based on the subfolder name of an official document.

Yi Meng tcp file transfer and Automatic Update system introduction (TCP File transfer) (iii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.