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

Adam D. Ruppe destructionator at gmail.com
Fri Sep 18 22:21:52 UTC 2020


On Friday, 18 September 2020 at 22:02:07 UTC, aberba wrote:
> In this case you want to get the file(s) in memory...in the 
> form of bytes (or buffer) and probably set a file size limit. 
> Its all doable through a library but such a library doesn't 
> exist in D yet. At least not that I know of.

I actually added *exactly* this to cgi.d in... 2010 if I remember 
right. I even kinda documented it: 
http://dpldocs.info/experimental-docs/arsd.cgi.Cgi.UploadedFile.contentInMemory.html

The threshold where it goes to a file is right now 10 MB and not 
configurable, but I've been meaning to go back and clean up this 
api a little. The max file size it accepts is configurable 
<http://dpldocs.info/experimental-docs/arsd.cgi.GenericMain.html> 
but the threshold where it goes from memory to file is not.

Though I should note that if vibe is putting it in a temporary 
file it probably realistically stays in memory anyway.... this 
whole thing might be about nothing since the OS is pretty good 
about optimizing temp files.

Just I have bigger things to take care of right now (or should I 
say smaller things?!)


More information about the Digitalmars-d-learn mailing list