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
- Code: Select all Expand view RUN
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
- Code: Select all Expand view RUN
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
//----------------------------------------------------------------------------------------//
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club********************************************************************