Use ftp to upload large files

Source: Internet
Author: User
When using asp.net to upload files, the processing of large files will always be unsatisfactory. Although theoretically, large files (more than MB) can be transferred ), however, various problems may occur in actual use. therefore, it is better to use FTP to upload large files based on the B/S architecture.

There is nothing to say about using FTP to manually upload files, but we often need to control this process through programs, that is, to achieve this through asp.net. if the FTP software has secondary development interfaces, you can. the classic cuteftp pro has this function.

After cuteftp pro 7 is installed, a file named ftpte (FTP transmission engine) is generated. ftpte provides many attributes and methods to conveniently upload large files through programming, including file filtering, directory and file detection, file deletion, renaming, transmission start and stop, and status viewing.

The following is an example:

Connect to the FTP server:

Set MySite = CreateObject ("CuteFTPPro. TEConnection ")

MySite. Protocol = "FTP"

MySite. Host = "ftp.cuteftp.net"

MySite. Login = "username"

MySite. Password = "password"

MySite. Connect
Upload files:

Set MySite = CreateObject ("CuteFTPPro. TEConnection ")

'Specify user, pass, host, and connect as normal...

MySite. Connect 'Recommended: call connect first

MySite. RemoteFolder = "Temp"

MySite. LocalFolder = "C: \ 123"

'Using relative path, all files in folder 123 are uploaded to the folder Temp off the current folder on the server.

MySite. Upload "*.*"
Download file:

Set MySite = CreateObject ("CuteFTPPro. TEConnection ")

'Specify user, pass, host, and connect as normal...

MySite. Connect 'Recommended: call connect first

'Next line changes to a predetermined folder so you can use a relative path in the download method

MySite. RemoteFolder = "/c:/Inetpub/ftproot/Temp /"

MsgBox (MySite. RemoteFolder) 'display current remote folder

MySite. Download "agent. ini", "c: \ temp \ agent1.ini"

'Now verify downloaded OK

If CBool (MySite. LocalExists ("c: \ temp \ agent1.ini") Then

MsgBox "File downloaded OK ."

End If
According to the experiment, ftpte supports various functions in C/S mode, and components cannot be found in B/S mode, which may be related to the absence of registration.

By using ftpte, you may program various functions such as remote file timing or irregular synchronization to achieve non-manual file transmission.

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.