Re: Get images or binary files from web form
- Posted by achury Oct 08, 2022
- 1807 views
Just this week I come back with this
Your code works well to me (Windows 7) Just needed to add platform(), so don't try to run windows specific code on linux machines.
I am also learning about how to parse form response.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition
Would be nice to have on standar lib a clever function may scan the binary input, from any web form, separate chunks using boundary, read the Content-Disposition on each section to define how to scan it. Usual form inputs are simply plain text, and files are binary blobs. Then return one simple sequence, something like.
{ {FORMTEXT, "FormName", "Bill Gates"}, {FORMTEXT, "FormCompany", "Microsoft"} {FORMFILE, "FormPhoto", {"myphoto.jpg", "Long Binary sequence here......"} } }
Marco Achury