Project

General

Profile

Can I capture byte blobs of WFileUpload without creating a file on target/host?

Added by Til Dawn almost 5 years ago

Hello

I am searching for a possibility of letting a user upload a huge file from a browser to a resource limited embedded device running a small Wt based HTTP-service and processing this file adhoc on host's side without using its file systems at all.

To avoid that the hosting embedded system is consuming too much memory (or flash) I am curious whether it's possible to capture the byte blobs transfered from browser to the backend that way that no file system of the host is in charge (even not a RAM file system).

The amount of data can be more than 1 GB but the storage of the embedded system is very limited (besides, I have to take care that such activity does provoke more wearing on the flash storage than necessary).

The huge file shall be decrypted/deflated and splitted into several smaller files adhoc by the service and forwarded to the subsystems (mainly based on bare-metal firmware).

So, simply said, from architecture and usability point of view (browser's perspective) WFileUpload is the tool I need but on backend side I saw no possibility (glancing thru the documentation) how to capture the transfered data before it is written to any intermediate location on the host's file system.

Additionally, I see a huge performance benefit in NOT using host's file systems to temporarily store the uploaded file but processing the uploaded byte-blobs adhoc (single touch approach).

Looking forward to any (hopefully not too complex) suggestion.

Best regards

til


Replies (3)

RE: Can I capture byte blobs of WFileUpload without creating a file on target/host? - Added by Wim Dumon almost 5 years ago

Hello Til,

Unfortunately, that is not supported by Wt, and I don't expect it to be a trivial change to support it. The only information you can get about incoming data before the upload is complete, is the amount of data that has been uploaded.

Best regards,

Wim.

RE: Can I capture byte blobs of WFileUpload without creating a file on target/host? - Added by Til Dawn almost 5 years ago

Hi Wim

thank you for your answer.

Is it more a limitation of the protocol (browser initiative dependent HTTP interaction) or would/could the Wt framework provide any alternative possibility to route the transfer of the incoming file contents to kind of a callback mechanism (slot, lambda etc.) instead of writing it to a temporary file?

Naively asking, if (from architecture point of view) it could make some sense to capture the HTTP request objects in the right moment (sounds crazy even to me) without breaking the integrity of Wt (states etc.) or putting it at uncontrollable risk.

Kind of a "user exit" or callback for the higher stack layers of the application would be perfect for carefully selected and very exceptional cases.

Best regards

til

RE: Can I capture byte blobs of WFileUpload without creating a file on target/host? - Added by Roel Standaert almost 5 years ago

There's no technical limitation in HTTP that would prevent this from being possible. It's just something Wt does not currently support, and it will likely take a good amount of replumbing to make it work.

Regards,

Roel

    (1-3/3)