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

WebFreak001 at
Thu Sep 17 16:32:55 UTC 2020

On Thursday, 17 September 2020 at 16:00:33 UTC, wjoe wrote:
> I found this [1] but unfortunately the post this refers to is a 
> dead link and the content, unfortunately, didn't tell me 
> anything that I didn't already find in the docs.
> What I can get from the form is the form fields with content, 
> the field name for the file upload and the file name. But the 
> file name is useless to me because I need the file content.
> Where is it stored ?
> [1]

hi, you can access HTTPServerRequest.files which contains the 
uploaded file.

Example in real code:


Note: the file is only downloaded from the client / stored on 
disk once you access the files or the form property, though this 
isn't documented.

I don't believe the temp file behavior is customizable as it is 
hardcoded here to write to a temporary file (which is called on 
form parsing):

However if you really wanted to (but I'd advise against it) you 
could parse the form data from the HTTPServerRequest.bodyReader 

More information about the Digitalmars-d-learn mailing list