elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Únete al Grupo Steam elhacker.NET


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP)
| | | |-+  Programación Visual Basic (Moderadores: LeandroA, seba123neo)
| | | | |-+  Problema función emulando inet
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Problema función emulando inet  (Leído 1,215 veces)
programatrix


Desconectado Desconectado

Mensajes: 3.287


Ver Perfil WWW
Problema función emulando inet
« en: 23 Diciembre 2005, 23:39 pm »

Pues nada, ya conseguí mi módulo que emula a inet. Y baja super bien..., pero para subir ficheros me estoy dejando el pellejo y no consigo nada.
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 
 
Y en un módulo de clase la función para subir
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
Pues la cuestión es que no me lo sube nunca, se conecta superbien y me descarga ficheros anteriormente subidos pero no es capaz de subir ninguno, haber si me podeis hechar una mano.
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
Saludos y ojala me podais ayudar  ::)


« Última modificación: 23 Diciembre 2005, 23:42 pm por Rey11 » En línea

Kizar


Desconectado Desconectado

Mensajes: 1.325


kizar_net


Ver Perfil
Re: Problema función emulando inet
« Respuesta #1 en: 24 Diciembre 2005, 00:30 am »

Dim bRet As Long

If bRet = False Then
        App.LogEvent "Devx Sample failed to upload file " & LocalFile
        Call MsgBox("Error") 'puesto por mi  ;D
        Exit Function
End If

si bRet no esta declarado como bolean, no va devolver true o false.

Eso creo yo, weno de toas maneras podias acer k un code espere a k se aya subido el archivo o algo.

Salu2


En línea

programatrix


Desconectado Desconectado

Mensajes: 3.287


Ver Perfil WWW
Re: Problema función emulando inet
« Respuesta #2 en: 24 Diciembre 2005, 11:22 am »

No creo que esté hay el problema. Lo que pasa es que está función devuelbe false:
Citar
FtpPutFile(hConnection, LocalFile, RemoteFile, FTP_TRANSFER_TYPE_BINARY, 0)
Por eso se compara y vale as long.
Voy haber si cogiendo código de la descarga puedo arreglarlo  ::)
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
problema conexión inet
Redes
q0ok 1 3,246 Último mensaje 17 Julio 2011, 17:37 pm
por int_0x40
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines