Creare una cartella sul area FTP

Moderator: Enrico Maria Giordano

Creare una cartella sul area FTP

Postby Romeo » Thu Mar 13, 2008 4:56 pm

Ciao,
mi pare di avere visto da qualche parte qualche indicazione di come creare una cartella su un'area FTP.

Non mi pare che con la classe TFTP o TFTPFile si riesca a farlo, eppure mi pareva di avere visto qualcosa in giro.

Qualche indicazione utile ?

FWH 2.4

Grazie
Romeo/Zingoni
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Re: Creare una cartella sul area FTP

Postby Enrico Maria Giordano » Thu Mar 13, 2008 5:33 pm

Code: Select all  Expand view  RUN
STATIC FUNCTION FTPCREATEDIR( cFtp, cPer, cUsr, cPsw, cDir )

    LOCAL hInternet, hConnect

    LOCAL lOk

    hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
    hConnect = INTERNETCONNECT( hInternet, cFtp, INTERNET_INVALID_PORT_NUMBER, cUsr, cPsw, INTERNET_SERVICE_FTP, 0, 0 )

    lOk = FTPCREATEDIRECTORY( hConnect, cPer + "/" + cDir )

    INTERNETCLOSEHANDLE( hConnect )
    INTERNETCLOSEHANDLE( hInternet )

    RETURN lOk


Code: Select all  Expand view  RUN
#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( FTPGETFILE )
{
    hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
}


HB_FUNC( FTPPUTFILE )
{
    hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( FTPDELETEFILE )
{
    hb_retl( FtpDeleteFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPCREATEDIRECTORY )
{
    hb_retl( FtpCreateDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPREMOVEDIRECTORY )
{
    hb_retl( FtpRemoveDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPFINDFIRSTFILE )
{
    hb_retnl( ( LONG ) FtpFindFirstFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( WIN32_FIND_DATA * ) hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETFINDNEXTFILE )
{
    hb_retl( InternetFindNextFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

#pragma ENDDUMP


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Romeo » Thu Mar 13, 2008 6:07 pm

Miiiiii,
la prima parte ok,
come faccio ad usare la seconda parte ?
Compilata normalmente mi risponde picche !

Grazie
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Postby Enrico Maria Giordano » Thu Mar 13, 2008 7:03 pm

In che senso? Metti semplicemente tutto dentro a un PRG e compila. Se ti dà degli errori è il caso di farmeli sapere, non credi? :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Romeo » Fri Mar 14, 2008 5:28 pm

Ciao EMG, compilando con FWH24 un minimale esempio.prg mi da i seg.errori:

Error: Unresolved external 'InternetOpenA'
Error: Unresolved external 'InternetCloseHandle'
Error: Unresolved external 'InternetConnectA'
Error: Unresolved external 'FtpGetFileA'
Error: Unresolved external 'FtpPutFileA'
Error: Unresolved external 'FtpDeleteFileA'
Error: Unresolved external 'FtpCreateDirectoryA'
Error: Unresolved external 'FtpRemoveDirectoryA'
Error: Unresolved external 'FtpFindFirstFileA'
Error: Unresolved external 'InternetFindNextFileA'

Grazie

Romeo
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Postby Enrico Maria Giordano » Fri Mar 14, 2008 5:33 pm

Devi includere la libreria wininet.lib che trovi nel tuo compilatore C.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8725
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Romeo » Fri Mar 14, 2008 5:58 pm

Ovviamente...funziona
Grazie 1000
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)

Postby Romeo » Mon Mar 24, 2008 7:03 pm

Ok,
Chiaramente tutto funziona.
Grazie 1000
Romeo
 
Posts: 340
Joined: Thu Jan 25, 2007 3:53 pm
Location: Milan (Italy)


Return to All products support

Who is online

Users browsing this forum: No registered users and 8 guests