Haber si me podeis ayudar.
Esta es la órden en el formulario para subir:
Código:
Function subir(fichero As String)
Dim oFTP As New clsFTP
oFTP.OpenConnection IP, usuario, pass, "/"
[quote] oFTP.UploadFile "C:\virus\a.zip", "a.zip"[/quote]
oFTP.CloseConnection
end function
Código:
Public Function UploadFile(ByVal LocalFile As String, ByVal RemoteFile As String) As Boolean
Dim bRet As Long
bRet = FtpPutFile(hConnection, LocalFile, RemoteFile, FTP_TRANSFER_TYPE_BINARY, 0)
If bRet = False Then
App.LogEvent "Devx Sample failed to upload file " & LocalFile
Call MsgBox("Error") 'puesto por mi ;D
Exit Function
End If
End Function
La función de descarga es esta:
Código:
Public Function DownloadFile(FileName As String, Destination As String) As Boolean
Dim sRemoteFile As String
Dim sNewFile As String
Dim sCurrentDir As String
On Error GoTo out
DownloadFile = False
'Only if a valid connection...
If hConnect Then
' Get the Current Internet directory
sCurrentDir = GetFTPDirectory(hConnect)
' Setup the file name to retrieve and the destination
sRemoteFile = sCurrentDir & FileName
If Right$(Destination, 1) <> "\" Then
Destination = Destination & sSlash
End If
sNewFile = Destination & FileName
'make sure there is no file with the same name as specified
Set oFSO = CreateObject("Scripting.FileSystemObject")
If oFSO.FileExists(sNewFile) Then
oFSO.DeleteFile sNewFile
End If
' Download file
If FtpGetFile(hConnect, sRemoteFile, sNewFile, False, FILE_ATTRIBUTE_ARCHIVE, _
FTP_TRANSFER_TYPE_UNKNOWN, 0&) Then
' Success
DownloadFile = True
ErrLog "clsFTP.DownloadFile: Download Succeeded. Time:" & CStr(Now), 4
Else
' Raise an error
ErrLog "clsFTP.DownloadFile: Download Failed. " & Err.Number & ":" & _
Err.Description, 1
End If
End If
Exit Function
out:
ErrLog "clsFTP.DownloadFile method failed. Error - " & Err.Description, 1
End Function