B4R Question Suggestion of idea on how to make a backup

Gerardo Tenreiro

Active Member
Licensed User
Hello,
I am finishing the ESP32 application and the client now tells me that he wants to have a backup copy of all the parameters of each of the devices in the cloud.
Each device has hundreds of parameters that can be modified from an application made in B4R and that are stored in the EEPROM memory of the ESP32.

I have a serial number for each ESP32 that is unique, it is made up of the WIFI MAC and an algorithm based on the year, month, day, hour, minute that the original software was installed for the first time. This number is 14 digits long. The application generates CSV files of the parameters and settings so the idea is to upload these files to a WEB and leave them inside a directory that is made up of the serial number.

Here I have the first problem. How do I know if the directory exists on the WEB and if not, create it?

I have a lot of trouble with the WEB so please, some suggestions
Thank you very much
 

Cliff McKibbin

Member
Licensed User
Rather than trying to store the parameters in a directory, you might consider storing them in a database on a hosted server.

This write-up describes storing records on a hosted server in order to sync device database records but your application would be very similar in that each device would have a unique Id and each parameter could have unique Id and therefore record.


Your front-end app would send the parameters as often as you wish. You could write the php database logic to create a new record or update it if it exists.
If a parameter changes in your front-end app, you could just send the one record, not all of the records.
The front-end app could also query the server database in order to refresh the parameters if needed, especially if the device hardware was changed out.

A 2nd front end app could be written in B4J or B4A to display all of the devices and allow them to be clicked or touched and then the parameters for that device would be displayed. You might want a third front end app for yourself to build the db table.

The models and actual logic for all of these ideas are in the above writeup.

My own hosted server from 1&1 Ionos is only $12.32/month so it is very affordable for most any company.

Handling a sql data base on a server will be a lot easier than trying to send whole files to another server.

Hope this might help.
Cliff McKibbin
 
Upvote 0

Gerardo Tenreiro

Active Member
Licensed User
As I mentioned, the server belongs to my client and I don't have access to it. At most, it allows me to upload a PHP script to make the POST work from the ESP32. So trying to set up a database is impossible.

Does anyone have any experience uploading files with POST from an ESP32?
I'm having some problems of all kinds and I don't know if it's the ESP32 code or the PHP script code.

Some example would be appreciated.

Thank you very much.
 
Upvote 0

rabbitBUSH

Well-Known Member
Licensed User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…