KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Unable to save to temp Directory #3132

Closed Charlie May opened this topic on on Aug 29, 2023 - 1 comments

Charlie May commented on Aug 29, 2023

I am attempting to export a report from Laravel. When I specify a view in the export method it tells me it can't save to the temp directory. If I don't include a view it works without issue (just ugly with the inputs fields) I'm not really sure what I'm missing here. I do notice a .tmp file being created but they are all blank. When I remove that view and the exports. In the tmp directory there is a .tmp and .pdf

Path to RegionalReport.php - App/Reports/tenant

Path: App/Reports/tenant regionalReportPdf.view.php

<html lang="en">
<head>
    <title></title>
</head>
<body>
This is just a test
</body>
</html>

ExportsController.php with custom view `php <?php class ExportsController extends Controller {

public function regional()
{
    $report = (new RegionalReport())->run();
    return $report->export('regionalReportPdf')->settings([
        "useLocalTempFolder"=>true,
        "autoDeleteTempFile" => true,
    ])->pdf([
        "format"=>"A4",
        "orientation"=>"portrait"
    ])->toBrowser(now()->timezone('America/Los_Angeles')->format('Ymd') . 'regional_compliance');
}

} ?> `ExportsController.php without custom view and works fine`php class ExportsController extends Controller {

public function regional()
{
    $report = (new RegionalReport())->run();
    return $report->export()->settings([
        "useLocalTempFolder"=>true,
        "autoDeleteTempFile" => true,
    ])->pdf([
        "format"=>"A4",
        "orientation"=>"portrait"
    ])->toBrowser(now()->timezone('America/Los_Angeles')->format('Ymd') . 'regional_compliance');
}

} `

Here is the full stack if it helps https://flareapp.io/share/J7oev0Gm

Charlie May commented on Aug 29, 2023

I think I got it. I deleted the file and recreated it and now its working. (may have been an issue with the name of the file)

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Export