Hello Nimians!

I'm well into making a CMS/site builder using Guildenstern, but i'm just now 
getting around to needing forms that upload files. I'm trying to use 
Guildenstern's streamingserver[1] and the receiveInChunks() iterator in an 
example program just to try and get it working. The Guildenstern examples stop 
short of actually showing you how to grab and save the file, AFAICT. If i echo 
the body(:string) of a POST request, i get something like this.

(This output is from an attempt without a file upload. If i would have added a 
file, in the second chunk it would have had a filename, a different 
Content-Type, and after that a bunch of gibberish which would have been the 
uploaded file itself (base64 encoded?).
    
    
    -----------------------------416231406732801938054063358022
    Content-Disposition: form-data; name="msg"
    
    hello, nimians!
    -----------------------------416231406732801938054063358022
    Content-Disposition: form-data; name="file"; filename=""
    Content-Type: application/octet-stream
    
    
    -----------------------------416231406732801938054063358022--
    
    
    Run

Is there something in the standard library to parse this string "format" to 
grab the data i need? Or what approach would you take? I've always had a 
request object with fields in the past, so i'm not sure what i'm supposed to be 
looking into. :)

Thanks in advance

  1. 
<https://olliniinivaara.github.io/GuildenStern/guildenstern/streamingserver.html#receiveInChunks.i>


Reply via email to