Re: Vibe.d form file attributes

2016-12-20 Thread aberba via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 18:42:11 UTC, WebFreak001 wrote: On Tuesday, 20 December 2016 at 18:22:51 UTC, aberba wrote: [...] iterate over req.files like this instead: foreach (name, picture; req.files) // name is "picture[]" now { ... } Nice. [...] pragma(msg, __traits(allMember

Re: Vibe.d form file attributes

2016-12-20 Thread WebFreak001 via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 18:22:51 UTC, aberba wrote: [...] Now I wanted to implement this in D (vibe.d) and here is what I did in the file upload handler. void upload(HTTPServerRequest req, HTTPServerResponse res) { import std.stdio; foreach(picture; req.files) // req.files inc

Vibe.d form file attributes

2016-12-20 Thread aberba via Digitalmars-d-learn
In PHP, I am able to access the name attribute of multiple files submitted through forms at the server side in $_FILES global. For example, a file input with name="picture[]" will allow me to upload multiples files with the same attribute name. This can be access in PHP as; $files = $_FILE