I have a question regarding the use of php to retrieve files which have been stored on a server.
I have been storing database files from my NSB/Appstudio application to my server by using a php file on the server. This has been working quite well. Now, I want to retrieve these files back to my app using php and I don’t know how to do it.
To store the files, I use the following code in my app:
req = Ajax(“http://###.###.#.##/xampp/saveBackUp.php”, “POST”, IniFileName & “,” & backToString)
If req.status = 200 Then
The php file on the server is as follows:<?php header('Access-Control-Allow-Origin: *'); ini_set('display_errors','1'); $backup_dir = "c:\\xampp\DBBackup\\"; // Get the data from the client. $myText = file_get_contents('php://input'); $tmp = explode(",",$myText); $myFile = $tmp; $myFile= $backup_dir . $myFile; echo "Data received from Device:
" . $myText; echo "
Writing data to " . $myFile; $f = fopen($myFile, 'w') or die("can't open file"); fwrite($f, $myText); fclose($f); ?>
I would really appreciate help in the form of sample code to place in my app as well as a sample php file for the server.