Documentation

Documentation versions (currently viewingVaadin 23)

Using StreamReceiver to Receive an Incoming Data Stream

To receive an upload from the client, we need to register a StreamReceiver that accepts a URL to handle receiving an upload stream.

To create a StreamReceiver, we first need to create a StreamVariable that monitors and controls terminal upload during the time it is being streamed.

Then the stream can be registered through the Element API.

StreamReceiver streamReceiver = new StreamReceiver(
    getElement().getNode(), "upload", getStreamVariable());
getElement().setAttribute("target", streamReceiver);

E14BB11E-3462-484B-A2A8-394B842A79DC