Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defun http-post-encode-multipart-data (fields files coding-system)
- "Return FIELDS and FILES encoded for use as the data for a multipart HTTP POST request"
- (http-post-join-strings
- (mapcar '(lambda (field)
- (http-post-bound-field
- (format "Content-Disposition: form-data; name=%S" (symbol-name (car field)))
- ""
- (cdr field)))
- fields)
- (mapcan '(lambda (file)
- (destructuring-bind (fieldname filename mime-type data) file
- (http-post-bound-field
- (format "Content-Disposition: form-data; name=%S; filename=%S" fieldname filename)
- (format "Content-type: %s" mime-type)
- ""
- data)))
- files)
- (format "--%s--" (http-post-multipart-boundary))))
Add Comment
Please, Sign In to add comment