Skip to content

[LiveComponent] Live Actions cannot handle file downloads #1516

Open
@richardhj

Description

As live actions are treated as regular controller actions, they should also support file responses.

#[LiveAction]
public function submit(): BinaryFileResponse
{
    $this->validate();

    return $this->file($this->exporter->generate($this->items));
}

Currently, file downloads are not downloaded but parsed..?

Screenshot 2024-02-18 at 13 28 23

Edit (current workaround)

public function submit(UriSigner $uriSigner): Response
{
    $this->validate();


    $file = $this->exporter->generate($this->items)

    $url = $this->generateUrl('admin_download', ['file' => base64_encode($file)]);

    return $this->redirect($uriSigner->sign($url));
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions