How to set up a custom sync server
Instead of Dropbox or OneDrive, the backup in Cartograph Maps can use your own web server. This guide shows how to add it in the app and what the server has to do. The server only stores files: it never needs to understand what is inside them.
This is not the Cartograph cloud sync service (tab Cartograph cloud sync), which always uses the Cartograph server. See Cloud sync and backup.
Add the server in the app
- Open the main menu → Backup manager, tab Cloud backup.
- Tap Select, then + → Custom webserver.
- Fill in:
- Name: any name, to recognise the server in the list.
- Server address: the command address of your server, e.g.
https://example.com/cartograph3/syncserver.php?token=ABC123. It may already carry query parameters such as a token; the app adds its own. - Download url: the address under which the files can be downloaded directly, e.g.
https://example.com/cartograph3/data. - Username and Password: optional, sent with every request as HTTP Basic authentication.
- Save, choose the folder on the server, and run Check status and Backup now.
With cloud sync, the server entry can be synced to your other devices (Cloud services in the sync items); the username and password are not synced and have to be entered again there.
Security: always use HTTPS: Basic authentication is only encoded, not encrypted. A token in the server address ends up in the web server’s logs, so treat it like a password. If several people use the server, give each a storage area of their own.
What the app stores on the server
| File | What it is |
|---|---|
appsync.zip | the index: a list of all entries in the backup (JSON in a ZIP) |
<category>_<random>.db | the entries of one category (tracks, overlays, maps, …) as SQLite files, each up to the File size set in the backup settings (10 MB by default) |
| media files | icons and images, copied as they are |
A backup run downloads appsync.zip, downloads the category files it needs, uploads the changed
category files and new media files, uploads a new appsync.zip, and deletes category files that
have become empty. If a run is interrupted, the next one sorts it out; the server needs no
rollback.
The server’s API
Every command is an HTTP request to the Server address with cmd=<command> added to the
query. GET for reading, POST for uploading. Every answer is a JSON object:
{ "error": false, "error_string": "optional text for the app's log" }
"error": false means success; anything else (no JSON, an empty body, "error": true) is a
failure. HTTP status codes don’t matter, except 404 and 410, which mean “this file
doesn’t exist yet” (normal before the first backup). Return a 200 with "error": true for errors
you want reported.
getFileList
Lists the files and folders in subDir.
GET syncserver.php?token=…&cmd=getFileList&subDir=/cartograph3
{
"error": false,
"file_list": [
{ "name": "appsync.zip", "is_dir": false, "mod_time": "2026-05-04T08:14:33", "size": 45012,
"url": "https://example.com/cartograph3/data/cartograph3/appsync.zip" },
{ "name": "media", "is_dir": true, "mod_time": "2026-05-04T07:00:00", "size": 0, "url": "" }
]
}
name: file or folder name, without path.is_dir:truefor folders.mod_time: ISO 8601 date and time.size: size in bytes (0 for folders).url: optional download address. If empty, the app uses Download url +/<subDir>/<name>.
uploadFile
Saves an uploaded file in subDir (create the folder if it is missing).
POST syncserver.php?token=…&cmd=uploadFile&subDir=/cartograph3&overwrite=true
The body is multipart/form-data with one file part named fileData; the file name is in
its Content-Disposition. overwrite is true or false (the backup always sends true).
Answer: { "error": false }.
createDirectory
GET syncserver.php?token=…&cmd=createDirectory&subDir=/cartograph3&newDir=media
Creates <subDir>/<newDir>. Answer: { "error": false }.
deleteFile
GET syncserver.php?token=…&cmd=deleteFile&filePath=/cartograph3/tracks_8a7d2b.db
Deletes the file or folder filePath. Answer: { "error": false }.
renameFile
GET syncserver.php?token=…&cmd=renameFile&oldFilePath=/cartograph3/old.db&newFilePath=/cartograph3/new.db
Not used by the backup itself, but by the app’s cloud file browser; recommended. Answer:
{ "error": false }.
Downloads
To download, the app sends a plain GET to the file’s url from the file list, or to
Download url + /<subDir>/<file name>. The answer is the file itself, without JSON. If you
set a username and password, they are sent here too. The Download url can simply be a folder
served by the same web server.
Rules for the server
- Reject path tricks in
subDirandfilePath:..segments, absolute paths, NUL bytes, anything outside the user’s storage folder. - Limit the upload size. Category files are at most the File size; media files can be larger.
- One backup runs one request after the other, so the server doesn’t have to handle parallel writes of one user.
- File names made by the app use
A–Z a–z 0–9 _ - .; media files keep their own names, which may contain any Unicode characters (UTF-8).
Example server
There is an example PHP implementation
(one file, syncserver.php) for trying it out at home. It implements all five commands as
described above and stores the files in a data folder beside the script. Before you use it:
- change the token in the first lines (
token=…in the Server address); - remove the line
'url' => …ingetFileList: as shipped, it builds addresses that don’t work, and without it the app uses your Download url, which should then point to thedatafolder.
Don’t run the example on a public web server. Its only protection is the fixed token and a
simple check for .. in paths; anyone with the token has full access to the files. Secure it
first (HTTPS, authentication, proper path checks), or write your own server along the rules above.