- Code: Select all Expand view RUN
- FUNCTION UPLOADFTP( cFileftp )
#define FILE_ATTRIBUTE_READONLY 1
#define FILE_ATTRIBUTE_HIDDEN 2
#define FILE_ATTRIBUTE_SYSTEM 4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE 32
#define FILE_ATTRIBUTE_NORMAL 128
#define FILE_ATTRIBUTE_TEMPORARY 256
#define INTERNET_OPEN_TYPE_PRECONFIG 0 // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT 1 // direct to net
#define INTERNET_OPEN_TYPE_PROXY 3 // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY 4 // prevent using java/script/INS
#define INTERNET_INVALID_PORT_NUMBER 0 // use the protocol-specific default
#define INTERNET_DEFAULT_FTP_PORT 21 // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT 70 // " " gopher "
#define INTERNET_DEFAULT_HTTP_PORT 80 // " " HTTP "
#define INTERNET_DEFAULT_HTTPS_PORT 443 // " " HTTPS "
#define INTERNET_DEFAULT_SOCKS_PORT 1080 // default for SOCKS firewall servers.
#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 GENERIC_READ 2147483648
#define GENERIC_WRITE 1073741824
LOCAL hInternet, hConnect, hSource, hDest, nRead
LOCAL cData := SPACE( 1024 )
LOCAL nPos := 0
cFile:=cFileftp
cFildes:="/files/"+cFilename(cFile)
hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )
hConnect = INTERNETCONNECT( hInternet, "myipaddress", INTERNET_INVALID_PORT_NUMBER, "myuser", "mypassword", INTERNET_SERVICE_FTP, 0, 0 )
hDest = FTPOPENFILE( hConnect, cFildes, GENERIC_WRITE, 0, 0 )
hSource = FOPEN( cFile )
WHILE .T.
nRead = FREAD( hSource, @cData, LEN( cData ) )
IF nRead = 0
IF FERROR() = 0
*? "El archivo ha sido generado exitosamente"
ELSE
? "Error al generar el archivo en el site FTP"
ENDIF
EXIT
ENDIF
IF !INTERNETWRITEFILE( hDest, @cData, nRead )
? "Error al intentar escribir el archivo en el servidor"
EXIT
ENDIF
nPos += LEN( cData )
ENDDO
FCLOSE( hSource )
INTERNETCLOSEHANDLE( hDest )
INTERNETCLOSEHANDLE( hConnect )
INTERNETCLOSEHANDLE( hInternet )
oDlg:end()
delete file &cFileftp
RETURN NIL
I got this error:
- Code: Select all Expand view RUN
- Error description: Error BASE/1099 Error de argumento: STR
Args:
[ 1] = U
Stack Calls
===========
Called from: => STR( 0 )
Called from: .\source\winapi\WININET.PRG => INTERNETOPEN( 44 )
Called from: C:\xDevStudio\Projects\Tubelite\Source\Tubelite.prg => UPLOADFTP( 8964 )
Called from: C:\xDevStudio\Projects\Tubelite\Source\Calendar.prg => ACTUAL( 1149 )
The wininet.prg file line 41 to 44 reads this:
- Code: Select all Expand view RUN
- DLL32 FUNCTION InternetOpen( cApp as LPSTR, n1 AS DWORD, n2 AS LPSTR, n3 AS LPSTR,;
n4 AS DWORD ) AS LONG PASCAL ;
FROM "InternetOpenA" LIB hWinINet
Any idea what is happenig?
Thanks for your help.