vibe.d: How to get the conent of a file upload ?

aberba karabutaworld at gmail.com
Thu Sep 17 22:13:37 UTC 2020


On Thursday, 17 September 2020 at 21:57:37 UTC, Steven 
Schveighoffer wrote:
> On 9/17/20 1:08 PM, wjoe wrote:
>> [...]
>
> the `files` property actually does the processing only when you 
> call it.
>
> If you access the `bodyReader` property directly, you can 
> process that data yourself. You can even register a web 
> interface function with an `InputStream` parameter type, and it 
> will be bound to the body data.

I'm not sure I understand how to do this and parser the files in 
memory.

>
> I've done this with my REST interface, though that's not form 
> data.
>
> That's not a great API, though. I would love to see vibe.d 
> allow a direct call to vibe.inet.webform.parseFormData with a 
> specific handler for files and form data.
Can we file an issue for this? Because I'm very interested in 
having this resolved

>
> I think you can agree that it's not feasible to store arbitrary 
> sized file contents in memory. But it certainly can provide a 
> mechanism to handle it as it's read.
>
> -Steve

There's potential to results in out of memory condition. Its a 
know issues. A complete parser (like multer in nodejs) allowance 
you to limit file size as well for error handling.

> I've done this with my REST interface, though that's not form 
> data.

Can you share your code for this?


More information about the Digitalmars-d-learn mailing list