Skip to main content

Upload · PushPath

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Put a file from this machine where the device keeps downloads, so an app's file picker finds it: Android's shared Download folder, or on iOS an app's own Documents folder, which the Files app shows under On My iPhone. These call app_upload.

Upload​

public IDictionary<string, object?> Upload(string path)
public IDictionary<string, object?> Upload(string path, string name)
public IDictionary<string, object?> Upload(string path, string? name, string app)

Puts a file from this machine where the device keeps downloads, so an app's file picker finds it, under the file's own name. On Android that is the shared Download folder, one for every app; the file is indexed in MediaStore, which is what the picker reads, and read back there. On an iOS simulator it is the Documents folder of the app in front, which the Files app shows under On My iPhone; on a real iPhone the same, through CoreDevice, confirmed by its bytes.

Returns The transfer: device, app (iOS), name, where, bytes, checked — how it was confirmed at both ends — and path.

As Upload(string), giving the file name on the device — a name, not a path.

As Upload(string), into the Documents of app, a bundle id, rather than the app in front. Android has one Download folder for every app and ignores it, so a test written for both platforms can name it on both. A null name keeps the file's own.

PushPath​

public IDictionary<string, object?> PushPath(string local, string devicePath, string? app = null)

Sends a local file or folder to a path on the device and reads every file's size back there. On Android devicePath is absolute, or with app a path in that app's private data, which needs a debuggable build. On iOS it is a path in an app's data container — the one named, or the one in front.

Returns The transfer, with files and folder.

Examples​

Send a file where the device keeps downloads​

var sent = device.Upload("invoice-42.txt");
Console.WriteLine($"{sent["where"]} {sent["bytes"]}");

The same call from the command line, mobium upload invoice-42.txt, printed on an Android 15 emulator:

uploaded …/invoice-42.txt to Download/invoice-42.txt (24 bytes) — confirmed by its size read back on the device, and MediaStore listing it

After mobium upload invoice-42.txt, the Files Demo&#39;s Upload a file opened the system picker, the file was in it, and the line under the button says the name, size and first line of what arrived — on an Android 15 emulator

After mobium upload invoice-42.txt, the Files Demo's Upload a file opened the system picker, the file was in it, and the line under the button says the name, size and first line of what arrived — on an Android 15 emulator

Send a folder to a path on the device​

var sent = device.PushPath("seed", "/sdcard/seed");
Console.WriteLine($"{sent["files"]} {sent["checked"]}");

The same call from the command line, mobium upload ./seed --device-path /sdcard/seed, printed on an Android 15 emulator:

uploaded …/seed to /sdcard/seed (a folder of 2 files, 8 bytes) — confirmed by each of its 2 files' sizes read back on the device