Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

twoarmtom's avatar

Viewing Files in Nova instead of downloading them

I'm currently using Nova in a project where I want to be able to view a file (PDF) in the browser instead of the default download link when I'm viewing the resource. If I use the preview function it says "This image could not be found." but it has a link to view the file (which opens in a new tab).

Is there a way to make the default behaviour when viewing the resource be a simple "View in browser" link?

Here's the current code that gets the "This image could not be found." But the words "This image" is a hyperlink that has the desired URL I want that opens the file in a new browser window.

File::make('File')
                ->preview(function ($value, $disk) {
                    return Storage::disk($disk)->url($value);
            }),
0 likes
1 reply
bobbybouwmann's avatar

At this point, it's not possible to do that in Nova. If you want this kind of functionality you have to build it yourself. You can easily create your own File component for this ;)

Please or to participate in this conversation.