MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 258 forks source link

Preview file #15

Closed lalov closed 4 years ago

lalov commented 4 years ago

Hi, very nice package!

In the service provider you are setting a named route:

    Route::get('/datatables/{filename}', [FileExportController::class, 'handle'])
        ->middleware(config('livewire.middleware_group', 'web'))
        ->name('livewire.preview-file');

This makes the file upload preview in other livewire components fail, as the TemporaryUploadedFile in LiveWire uses the same name.

    return URL::temporarySignedRoute(
        'livewire.preview-file', now()->addMinutes(30), ['filename' => $this->getFilename()]
    );

When using the upload preview, it fails with HTTP 500, as it then makes a link to a preview file in the /datatables/ directory on the server instead of the /livewire/preview-file/ url.

marksalmon commented 4 years ago

Thanks, good catch. Fixed now.