That's a Client-RC function, and a terrible file browser.
With solely just script.
PHP Code:
function onCreated() {
temp.file.loadstring("level/path/to/file.png");
temp.data = base64encode(temp.file);
player.triggerclient("weapon", this.name, "file", "file.png", temp.data);
}
//#CLIENTSIDE
function onActionClientSide() {
if (params[0] == "file") {
temp.data = base64decode(params[2]);
temp.data.savestring(params[1], 0); // Saves to Graal/scriptfiles/Servername/file.png
echo("Downloaded " @ params[1] @ "!");
}
}
Side note, just stumbled upon these functions in /scripthelp:
generatezipstring(obj) - returns string - creates a zip in memory from the array you provide like {filename, content, filename, content, ...}, save to file using str.savestring(filename, 0)
decompressfile(str, str, str, int) - returns boolean - parameters are filename, file name pattern (*), destination folder and flags (1 (keep zip paths) + 2 (keep original modification time)); unzips a file into the specified folder