PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Downloading a file found on an FTP server
  • Downloading a file found on an FTP server
  • Downloading a file found on an FTP server (WINDEV Mobile)
  • Downloading a file found on an FTP server (WINDEV Mobile)
Downloading a file found on an FTP server
WINDEVWEBDEV - Server codeReports and QueriesJavaAjaxUser code (UMC) This example is used to download a file found on the FTP server onto the current computer. This example does not manage the progress of the transfer.
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com", "GUEST", "")
IF nConnection = -1 THEN
Error("Unable to establish connection to the server")
ELSE
IF FTPGet(nConnection, "/autoexec.bat", "C:\Temp\") = True THEN
Info("Transfer completed")
ELSE
Error("The transfer failed")
END
END
Downloading a file found on an FTP server
WINDEVWEBDEV - Server codeReports and QueriesJavaAjaxUser code (UMC) This example is used to download a file found on the FTP server onto the current computer. This example manages the progress of the transfer.
ServerIP is string
nConnection is int
nConnection = FTPConnect(IPServer, "anonymous", "")
IF nConnection = -1 THEN
Error("Unable to establish the connection to the server")
ELSE
IF FTPGet(nConnection, "/Info.txt", "C:\Temp\", "FTPDownload") = True THEN
Info("Transfer completed")
ELSE
Error("The transfer failed")
END
END
PROCEDURE FTPDownload(tTotalSize, tTransferedSize)
Message("FTP transfer in progress: " + tTransferedSize + ...
" bytes received of " + tTotalSize + "total.")
RESULT True
Downloading a file found on an FTP server (WINDEV Mobile)
Windows Mobile This example is used to download a file found on the FTP server onto the current computer (Mobile). This example does not manage the progress of the transfer.
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com", "GUEST", "")
IF nConnection = -1 THEN
Error("Unable to establish the connection to the server")
ELSE
IF FTPGet(nConnection, "/autoexec.bat", "\Temp\") = True THEN
Info("Transfer completed")
ELSE
Error("The transfer failed")
END
END
Downloading a file found on an FTP server (WINDEV Mobile)
Windows Mobile This example is used to download a file found on the FTP server onto the current computer (Mobile). This example manages the progress of the transfer.
ServerIP is string
nConnection is int
nConnection = FTPConnect(IPServer, "anonymous", "")
IF nConnection = -1 THEN
Error("Unable to establish the connection to the server")
ELSE
IF FTPGet(nConnection, "/Info.txt", "\Temp\", "FTPDownload") = True THEN
Info("Transfer completed")
ELSE
Error("The transfer failed")
END
END
PROCEDURE FTPDownload(tTotalSize, tTransferedSize)
Message("FTP transfer in progress: " + tTransferedSize + ...
" bytes received of " + tTotalSize + "total.")
RESULT True
Minimum version required
  • Version 9
This page is also available for…
Comments
FtpGet

s_arquivo_endereco_local is string=ftp_conf.endereco_local // "d:\erpmatos\Atualizacao\"
s_arquivo_endereco_remoto is string=ftp_conf.endereco_remoto+TABLE_remoto.COL_nome_arquivo // "/web/_Windev_Erp_matos/matos.jpg"
IF FTPGet(n_conexao,s_arquivo_endereco_remoto,s_arquivo_endereco_local,transfere_remoto_barra) = False THEN
Info("erro transferencia")
END

//FTPGet(n_conexao,"d:\erpmatos\Atualizacao\","/web/_Windev_Erp_matos/matos.jpg",transfere_remoto_barra)

//essa procedure é usada no ftpget
PROCEDURE transfere_remoto_barra(_total_tamanho,_valor_atual)
Gauge(_valor_atual,_total_tamanho) // vai ser na barra de status o progresso
RESULT True
//essa procedure é usada no ftpget
De matos AMARILDO
04 Jan. 2016
 Example Download Files via Mobile, Webdev, Windev (Download de arquivos)
//HTM_Download..URL="http://www.7-zip.org/a/7z920.exe"

OK is boolean = HTTPRequest("http://www.7-zip.org/a/7z920.exe")

IF OK = True THEN

Arquivo is Buffer = HTTPGetResult(httpResult)

IF InSimulatorMode() = True
OK = fSaveBuffer("c:\download\7z920.exe",Arquivo)
ELSE
OK = fSaveBuffer("/mnt/sdcard/7z920.exe",Arquivo)
END

IF OK = True THEN

IF InSimulatorMode() = True
OK = fFileExist("c:\download\7z920.exe")
ELSE
OK = fFileExist("/mnt/sdcard/7z920.exe")
END

IF OK = True THEN
Info("Download do arquivo 7z920.exe com sucesso!")
ELSE
Error("Nao foi possivel encontrar o arquivo do 7z920.exe. "+ErrorInfo(errMessage))
END

ELSE
Error("Nao foi possivel efetuar o download do 7z920.exe. "+ErrorInfo(errMessage))
END

ELSE

Error("URL nao encontrado para download do 7z920.exe. "+ErrorInfo(errMessage))

END
adrianoboller
17 Jan. 2015