Hello,
I want my customers to be able to upload a file to a predefined webspace (it's usually a JPG- or a BMP-file for their logo in documents).
How can I obtain this in FWH?
Thanks a lot in advance.
driessen wrote:Hello,
I want my customers to be able to upload a file to a predefined webspace (it's usually a JPG- or a BMP-file for their logo in documents).
How can I obtain this in FWH?
Thanks a lot in advance.
driessen wrote:Thanks for your reply, Enrico.
I thought so already.
The samples in FWH about FTP are very simple.
I need an example to connect to a FTP-site, using a login and password.
Then I need to upload a file to a certain folder on the FTP-site.
Anyone an example?
Thanks a lot.
FUNCTION FTPWRITEFILE( cServerName, cRemotePath, cUserName, cPassword, cFileName )
LOCAL hInternet, hConnect
LOCAL lOk
hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
hConnect = INTERNETCONNECT( hInternet, cServerName, INTERNET_DEFAULT_FTP_PORT, cUserName, cPassword, INTERNET_SERVICE_FTP, MODE, 0 )
lOk = FTPPUTFILE( hConnect, cFileName, cRemotePath + "/" + CFILENAME( cFileName ), 0, 0 )
INTERNETCLOSEHANDLE( hConnect )
INTERNETCLOSEHANDLE( hInternet )
RETURN lOk
#pragma BEGINDUMP
#include "windows.h"
#include "wininet.h"
#include "hbapi.h"
HB_FUNC( INTERNETOPEN )
{
hb_retnl( ( LONG ) InternetOpen( hb_parc( 1 ), hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parnl( 5 ) ) );
}
HB_FUNC( INTERNETCLOSEHANDLE )
{
hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}
HB_FUNC( INTERNETCONNECT )
{
hb_retnl( ( LONG ) InternetConnect( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( INTERNET_PORT ) hb_parnl( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) ) );
}
HB_FUNC( FTPPUTFILE )
{
hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}
#pragma ENDDUMP
driessen wrote:Enrico,
I got 2 problems.
1. If I build my test FTP.EXE, I got an error of an unresolved external symbol : "_HB_FUN_CFILENAME" referenced from FTP.OBJ.
I replaced the function CFILENAME() by ALLTRIM() and then building is ok.
driessen wrote:2. When executing my test, I get an error : Variable does not exist : INTERNET_OPEN_TYPE_DIRECT.
// Wininet constants
#define INTERNET_OPEN_TYPE_PRECONFIG 0
#define INTERNET_OPEN_TYPE_DIRECT 1
#define INTERNET_OPEN_TYPE_PROXY 3
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4
#define INTERNET_INVALID_PORT_NUMBER 0
#define INTERNET_DEFAULT_FTP_PORT 21
#define INTERNET_DEFAULT_GOPHER_PORT 70
#define INTERNET_DEFAULT_HTTP_PORT 80
#define INTERNET_DEFAULT_HTTPS_PORT 443
#define INTERNET_DEFAULT_SOCKS_PORT 1080
#define INTERNET_SERVICE_FTP 1
#define INTERNET_SERVICE_GOPHER 2
#define INTERNET_SERVICE_HTTP 3
#define INTERNET_FLAG_TRANSFER_ASCII 1
#define INTERNET_FLAG_TRANSFER_BINARY 2
#define INTERNET_FLAG_ACTIVE 0
#define INTERNET_FLAG_PASSIVE 134217728
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 95 guests