Skip to content

Get Media File

Get specified file from device album and automatically save to local, return saved file path.

Interface Description

Interface Type

getMediaFile

Parameters

ParameterTypeRequiredDescription
deviceIdstringDevice ID
fileNamestringFile name

Return Value

Returns local path of saved file (string):

javascript
"C:/AppData/Temp/IMG_0001.JPG"  // Full path of local file

💡 Note

iClick will automatically download file from device and save to local temp directory. The returned path is the saved file path, which you can use directly to access the file.

Basic Usage

javascript
// Get specified file
const localPath = await apiInvoke('getMediaFile', {
    deviceId: 'P72578581E07',
    fileName: 'IMG_0001.JPG'
});

console.log('File saved to:', localPath);
// Output: D:/AppData/Temp/IMG_0001.JPG

Cooperation: try.catch@foxmail.com