Ademar,
I think that's difficult for security reasons.
I did some tests today.
What I managed to do is to send a txt or json file.
I exported the DBF file to TXT and json-encoded the file.
I read the TXT file into a variable, and then I make a FORMDATA object that I upload with AJAX.
At the backend, you then have the entire harbor scope and can format the result.
Besst regards,
Otto
upload.prg
function main()
TEMPLATE
<!doctype html>
<html lang="en">
<head>
聽 <!-- Required meta tags -->
聽 <meta charset="utf-8">
聽 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
聽 <title>Ihre Anmeldung</title>
</head>
<body>
聽 <script src="assets/js/jquery.min.js"></script>
聽 <script src="assets/bootstrap/js/bootstrap.min.js"></script>
聽 <script>
var allText ="";
function readTextFile(file)
{
聽 聽 var rawFile = new XMLHttpRequest();
聽 聽 rawFile.open("GET", file);
聽 聽 rawFile.onreadystatechange = function ()
聽 聽 {
聽 聽 聽 聽 if(rawFile.readyState === 4)
聽 聽 聽 聽 {
聽 聽 聽 聽 聽 聽 if(rawFile.status === 200 || rawFile.status == 0)
聽 聽 聽 聽 聽 聽 {
聽 聽 聽 聽 聽 聽 聽 聽 聽allText = rawFile.responseText;
聽 聽 聽 聽 聽 聽 }
聽 聽 聽 聽 }
聽 聽 }
聽 聽 rawFile.send(null);
}
//var file ="newfile.txt";
var file ="customer.json";
readTextFile( file );
$( document ).ready(function() {
聽 聽 console.log( "ready!" );
聽 聽
聽 聽 var fd = new FormData();
聽 聽 fd.append('data',allText);
聽 聽 $.ajax({
聽 聽 type: "post",
聽 聽 url: "https://test.com/modharbour_samples/data.prg",
聽 聽 data: ( fd ),
聽 聽 contentType: false,
聽 聽 聽 聽 聽 聽 聽 processData: false,
聽 聽 success: function(response) {
聽 聽 聽 聽 console.log(response);
聽 聽 }
});
聽 聽
});
聽 </script>
聽
</body>
</html>
ENDTEXT
return NIL
//----------------------------------------------------------------------------------------//
data.prg
REQUEST DBFCDX
REQUEST DBFFPT
function main()
聽 聽 local hPairs := AP_Body()
聽 聽 local hdata := {=>}聽
聽 聽 cLog := ValToChar( hPairs ) + CRLF
聽 聽 MEMOWRIT("c:\www\htdocs\modharbour_samples\log.log" , cLog, .f. )
聽 聽 hData['error'] := 'true'
聽 聽
聽 聽 AP_SetContentType( "application/json" )
聽 聽
聽 聽 ?? hb_jsonEncode( hdata, .T. )聽 // T=pretty
聽 聽
return NIL
//----------------------------------------------------------------------------------------//