FoxPro/Visual FoxPro - Error FtpOpenFile

 
Vista:
sin imagen de perfil

Error FtpOpenFile

Publicado por Karen Barrios (7 intervenciones) el 16/07/2014 23:14:49
Buenas tardes,
estoy tratando de subir archivos al FTP, mi programa ya logra conectarse al FTP, pero al momento de subir el archivo la función FtpOpenFile me devuelve 0 y no me deja subir el archivo, este es el código que uso:

Asi la declaro:

DECLARE INTEGER FtpOpenFile IN wininet.dll;
INTEGER nFtp,;
STRING sFileName,;
INTEGER lAccess,;
INTEGER lFlags,;
INTEGER lContext

Aqui deberia subir el archivo:

LPARAMETERS nFtp,lcsource,lctarget

hsource = FOPEN(lcsource)
IF (hsource = -1)
RETURN -1
ENDIF
htarget = ftpopenfile( ;
nFtp, ;
lctarget, ;
GENERIC_READ, ;
2, ;
0 )

Gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Error FtpOpenFile

Publicado por Ernesto Hernandez (4623 intervenciones) el 17/07/2014 15:57:41
puedes utilizar la dll de chilkat


LOCAL loFtp
LOCAL lnSuccess
LOCAL lcLocalFilename
LOCAL lcRemoteFilename

* This CreateObject statement uses the new single-DLL ActiveX for v9.5.0
loFtp = CreateObject('Chilkat_9_5_0.Ftp2')

* Any string unlocks the component for the 1st 30-days.
lnSuccess = loFtp.UnlockComponent("Anything for 30-day trial")
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
QUIT
ENDIF

loFtp.Hostname = "ftp.myftpserver.com"
loFtp.Username = "mylogin"
loFtp.Password = "mypassword"

* Connect and login to the FTP server.
lnSuccess = loFtp.Connect()
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
QUIT
ENDIF

* Change to the remote directory where the file will be uploaded.
lnSuccess = loFtp.ChangeRemoteDir("junk")
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
QUIT
ENDIF

lcLocalFilename = "hamlet.xml"

lcRemoteFilename = "hamlet.xml"

* Begin the upload in a background thread.
* Only 1 background upload or download may be active at any time.
* (per instance of an FTP object)
* To append to an existing file in the background, call
* AsyncAppendFileStart instead.
lnSuccess = loFtp.AsyncPutFileStart(lcLocalFilename,lcRemoteFilename)
IF (lnSuccess <> 1) THEN
? loFtp.LastErrorText
QUIT
ENDIF

* The application is now free to do anything else
* while the file is uploading.
* For this example, we'll simply sleep and periodically
* check to see if the transfer if finished. While checking
* however, we'll report on the progress in both number
* of bytes tranferred and performance in bytes/second.
DO WHILE loFtp.AsyncFinished <> 1

? loFtp.AsyncBytesSent + " bytes sent"
? loFtp.UploadRate + " bytes per second"

* Sleep 1 second.
loFtp.SleepMs(1000)
ENDDO

* Did the upload succeed?
IF (loFtp.AsyncSuccess = 1) THEN
? "File Uploaded!"
ELSE
* The error information for asynchronous ops
* is in AsyncLog as opposed to LastErrorText
? loFtp.AsyncLog
ENDIF

loFtp.Disconnect()
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Error FtpOpenFile

Publicado por Dario (3 intervenciones) el 30/12/2015 10:21:20
Hola
por favor podrias explicarme como usar el control ocx en el formulario. Gracias
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar