Guest User

Untitled

a guest
Apr 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1.  
  2. (defun http-post-encode-multipart-data (fields files coding-system)
  3. "Return FIELDS and FILES encoded for use as the data for a multipart HTTP POST request"
  4. (http-post-join-strings
  5. (mapcar '(lambda (field)
  6. (http-post-bound-field
  7. (format "Content-Disposition: form-data; name=%S" (symbol-name (car field)))
  8. ""
  9. (cdr field)))
  10. fields)
  11. (mapcan '(lambda (file)
  12. (destructuring-bind (fieldname filename mime-type data) file
  13. (http-post-bound-field
  14. (format "Content-Disposition: form-data; name=%S; filename=%S" fieldname filename)
  15. (format "Content-type: %s" mime-type)
  16. ""
  17. data)))
  18. files)
  19. (format "--%s--" (http-post-multipart-boundary))))
Add Comment
Please, Sign In to add comment