在VB中进行FTP软件开发时用到的两个基本模块,上传文件和下载文件,两函数都挺简单,函数代码如下示:
一、FTP上传文件函数:
1 | Public Function PutFTPFile( ByVal localFile As String , ByVal strRemoteFile As String ) As Boolean |
2 | Dim Info As Boolean |
3 | If lngInetConn = 0 Then |
4 | PutFTPFile = False |
5 | Else |
6 | Info = FtpPutFile(lngInetConn, localFile, strRemoteFile, 1, 0) |
7 | PutFTPFile = Info |
8 | End If |
9 | End Function |
FTP上传文件函数参数:strRemoteFile 远程文件名;localFile 本地文件名。
二、FTP下载文件函数:
1 | Public Function GetFTPFile( ByVal strRemoteFile As String , ByVal localFile As String ) As Boolean |
2 | Dim Info As Boolean |
3 | If lngInetConn = 0 Then |
4 | GetFTPFile = False |
5 | Else |
6 | Info = FtpGetFile(lngInetConn, strRemoteFile, localFile, 0, 0, 1, 0) |
7 | GetFTPFile = Info |
8 | End If |
9 | End Function |
FTP下载文件函数参数:strRemoteFile 远程文件名,localFile 本地文件名。
联系客服