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