18.1 Receive an upload from the client

The typical configuration of an uploading WebAPI looks like this:

(post "/upload" #:from-post '(store #:path "upload" #:sync #f)
      (lambda (rc)
        (case (:from-post rc 'store)
          ((success) (response-emit "upload succeeded!"))
          ((none) (response-emit "No uploaded files!"))
          (else (response-emit "Impossible! please report bug!")))))

However, you may use the low-level API for more configurations as well:

(store-uploaded-files rc #:path (current-upload-path)
                      #:uid #f
                      #:gid #f
                      #:simple-ret? #t
                      #:mode #o664
                      #:path-mode #o775
                      #:sync #f)

rc is the route-context.

#:path is the specified path to put uploaded files.

#:uid is new UID for the uploaded files, #f uses the default UID.

#:gid specifies the GID.

#:simple-ret? specifies the mode of return:

#:mode chmod files to mode.

#:path-mode chmod upload path to mode.

#:sync sync while storing files.