I'm posting a file to my web app using the following form:

<form accept-charset="UTF-8" action="@(url-for 'upload-contacts 
(organization-id org-obj))"
      method="post" *enctype="multipart/form-data"* 
class="file-upload-form">
...
</form>

I use a simple function to create a hashtable of attributes:

(define (form-values req)
  (for/hash ([ b (in-list (request-bindings/raw req)) ])
    (cond [ (binding:form? b) (values
                               (bytes->string/utf-8 (binding-id b) #\space)
                               (bytes->string/utf-8 (binding:form-value b) 
#\space)) ]
          [ (binding:file? b) (values
                               (bytes->string/utf-8 (binding-id b) #\space)
                               (binding:file-content b)) ])))

It appears that the entire file contents are in the binding by the time the 
request is available to me. This is fine for "small enough" files, but for 
larger files, it would be great to be able to stream the file contents. The 
solution may be to use something like nginx's upload module:

https://www.nginx.com/resources/wiki/modules/upload/

But before I go down that route, I thought I'd ask if the Racket web server 
provides a more direct way to accomplish this.

Thanks,
Brian

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/97fe4333-5778-4c47-94e0-1e5713e54b22%40googlegroups.com.

Reply via email to