When the user exports a report in the viewer, the generated file can be sent back to the server and saved — handled in the onEndExportReport event.

Save the exported file in PHP.
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';

$viewer->onEndExportReport = function (StiExportEventArgs $args) {
    $reportName = $args->fileName . '.' . $args->fileExtension;
    file_put_contents("../reports/$reportName", base64_decode($args->data));

    return StiResult::getSuccess("Saved to '$reportName'.");
};

$viewer->handler->process();
$viewer->report = $report;

How it works. The export travels from the client viewer to the PHP event, so exported files can be archived on the server automatically.
In the screenshot below you can see the result of the sample code:

Sending an Exported Report to the Server-Side

Hi. Need any help?