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.