Surface LiveComponent handle submit uploads

I’m using Surface, and I have a LiveComponent that renders a form to do some upload of photos.

Everything works till the part when I press submit on the form, which throws an Error saying.

“no uploads have been allowed on LiveView named DoomWeb.SettingsInfoLive”

I dont understand why would the parent have any concern about what a LiveComponent is doing.

I dont want in any shape or form for the LiveView to have any control about what happens inside a LiveComponent.

When I add a new file to the @uploads that comes from the LiveComponent it does not complain because it has the @uploads done correctly… why it would be concern when the form is submited?

Some code:

<Form for={:upload} multipart={true} change="upload_validate" submit="upload">
{#for entry <- @uploads.file.entries}


I also tried, like it mentions from the document, or from what I understoon from the documentation.

<button :on-click={"upload", target: @myself}>Upload</button>

So my question is why is LiveView concern about @uploads?
why is not a LiveComponent handling the problem?

1 Like

@Narven, did you call allow_upload within the component? Phoenix.LiveView — Phoenix LiveView v0.17.11

I did the allow_upload on the LiveComponent, which is where I am doing all the logic for the uploads

      |> allow_upload(
        accept: ~w(.jpg .jpeg .png .docx .pptx .doc .pdf),
        # max_entries: 1,
        max_file_size: 10_000_000
        # progress: &handle_progress/3

Maybe this helps?

Will take a look thanks.