vb6ftp
虽然不是用inet实现,但是这是非常完整的一个FTP实现。
2. 请教VB高手,用VB6写个用ftp下载文件的源代码,追加高分
老式的传输代码都不能用了,可能是服务器安全级别的关系
终于找到一个,这是一个完整的ftp客户端,测试好用
3. vb6.0用inet空间获取ftp文件列表的问题
从上面代码看, OperationStyle变量没有定义,所以出现上述问题。
其他代码不变,只对下面代码进行修改即可:
Case 12 ‘不要8
Select Case OperationStyle
Case 2
Text1.Text = Text1.Text & vbCrLf & "成功改变目录"
listserver
Case Else
Text1.Text = Text1.Text & vbCrLf & "成功列出目录"
ListView1.ListItems.Clear
inetdata = Inet1.GetChunk(1024, 0)
If Trim(inetdata) <> 0 Then
temparray = Split(inetdata, vbCrLf, , vbTextCompare)
i = 0
Do While i < UBound(temparray)
If temparray(i) <> "" Then
deallist (temparray(i))
End If
i = i + 1
Loop
End If
End Select
End Select
Text1.SelLength = Len(Text1.Text)
End Sub
4. VB6 如何使用ftp上传文件到服务器
Option Explicit
Public Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" _
(ByVal sAgent As String, ByVal LAccessType As Long, ByVal sProxyName As String, _
ByVal SProxyBypass As String, ByVal lFlags As Long) As Long
Public Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" _
(ByVal hInternetSession As Long, ByVal sServerName As String, _
ByVal nServerPort As Integer, ByVal sUsername As String, _
ByVal sPassword As String, ByVal lService As Long, _
ByVal lFlags As Long, ByVal lContext As Long) As Long
Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _
(ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _
ByVal lpszNewFile As String, ByVal fFailIfExists As Boolean, _
ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
Public Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _
(ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
Public Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" _
(ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Public Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" _
(ByVal hFtpSession As Long, ByVal lpszExsiting As String, ByVal lpszNew As String) As Boolean
Public Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Public Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" _
(ByVal hFtpSession As Long, ByVal lpszSearchFile As String, _
lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, _
ByVal dwContent As Long) As Long
Public Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" _
(ByVal hFind As Long, lpvFndData As WIN32_FIND_DATA) As Long
Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Public Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Public Type WIN32_FIND_DATA
dwFilAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * 260
cAlternate As String * 14
End Type
Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Private Sub Command1_Click()
lnginet = InternetOpen(vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, vbNullString, 0&)
If lnginet Then
lnginetconn = InternetConnect(lnginet, "ip地址", 0, _
"用户名", "密码", 1, 0, 0)
If lnginetconn Then
blnRC = FtpGetFile(lnginetconn, "website/address.asp", "c:/address.asp", 0, 0, 1, 0)
If blnRC Then
MsgBox "download ok!!!"
End If
InternetCloseHandle lnginetconn
InternetCloseHandle lnginet
MsgBox "close ok!!!"
Else
MsgBox "can't connect"
End If
Else
MsgBox "ftp wrong"
End If
End Sub
Private Sub Command2_Click()
Dim pData As WIN32_FIND_DATA
Dim lngHINet As Long
Dim intError As Integer
Dim strTemp As String
Dim blnRC As Boolean
pData.cFileName = String(260, 0)
lnginet = InternetOpen(vbNullString, INTERNET_OPEN_TYPE_PRECONFIG, _
vbNullString, vbNullString, 0&)
If lnginet Then
lnginetconn = InternetConnect(lnginet, "IP地址", 0, _
"用户名", "密码", 1, 0, 0)
If lnginetconn Then
lngHINet = FtpFindFirstFile(lnginetconn, "*.*", pData, 0, 0)
strTemp = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1)
Do
pData.cFileName = String(260, 0)
blnRC = InternetFindNextFile(lngHINet, pData)
If Not blnRC Then
Exit Do
Else
strTemp = Left(pData.cFileName, InStr(1, pData.cFileName, String(1, 0), vbBinaryCompare) - 1)
End If
Loop
Text1.Text = strTemp
End If
End If
InternetCloseHandle lngHINet
InternetCloseHandle lnginetconn
InternetCloseHandle lnginet
End Sub
5. vb6.0 ftp上传文件
c c c看不懂,直白点,有点乱~
6. VB6做一个简单的FTP下载问题
iNet的Excute方法有4给参数,url、operation、data 和requestHeaders
实现ftp的时候前两个参数需要,就是说应该是iNet1.Excute "FTP://61.235.123.26","GET test.mdb d:\test.mdb",不需要分成2个操作
7. 使用VB6 INET上传/下载文件 到FTP的问题
您使用的是虚拟机,以您的FTP空间的业务,对不对?
程序到您的网页文件夹
如果你需要你的数据库(访问)更安全,把访问文件过程中的DB文件夹的路径程序访问文件的访问权限下一步要做的改变。
当然你也可以不移动访问文件。
Log文件夹是IIS虚拟空间将访问日志与你的虚拟空间有关。主要是log档供您查看。
希望对你有所帮助。
8. 如何用VB6.0实现本地文件上传到网站服务器空间ftp我要完整代码啊!谢谢!
用inet控件是可以实现啊。
Inet1.URL = "ftp://用户名:密码@IP"
Inet1.OpenURL
Inet1.Execute "ftp://用户名:密码@IP", "put c:\a.txt a.txt" 'put后第一个参数是文件具体路径,后一个参数是上传到FTP后的文件名,可以与原来相同,也可以另外起名字。
有不清楚的,可以qq:83159173
9. VB6.0下下载FTP上指定文件的文件的模块,或类,或dll
FTP操作模块
'文件下载示例:
Private Sub Form_Load()
Dim FTP As FTP
Set FTP = New FTP
Call FTP.Connect("127.0.0.1", 21, "username", "password")
Call FTP.GetFile("/wwwroot/index.asp", "c:abcd.asp")
Set FTP = Nothing
End Sub