Skip to content

Instantly share code, notes, and snippets.

@febuiles
Created December 8, 2008 02:11
Show Gist options
  • Select an option

  • Save febuiles/33312 to your computer and use it in GitHub Desktop.

Select an option

Save febuiles/33312 to your computer and use it in GitHub Desktop.
;; http://www.emacswiki.org/cgi-bin/wiki/http-post-simple.el
(http-post-simple-multipart "http://www.tumblr.com/api/write"
(list (cons 'caption "foo")
(cons 'type "photo")
(cons 'email "something")
(cons 'password "something")
(cons 'group "testingtumble.tumblr.com"))
(list "data" "avatar.png" "image/png" (file-data "/home/federico/avatar.png")))
(defun file-data (filename)
(with-temp-buffer
(insert-file-contents-literally filename)
(buffer-substring-no-properties (point-min)
(point-max))))
;; Error
Debugger entered--Lisp error: (wrong-type-argument listp "data")
cdr("data")
(setq --cl-rest-- (cdr --cl-rest--))
(prog1 --cl-rest-- (setq --cl-rest-- (cdr --cl-rest--)))
(car (prog1 --cl-rest-- (setq --cl-rest-- ...)))
(pop --cl-rest--)
(if (= (length --cl-rest--) 4) (pop --cl-rest--) (signal (quote wrong-number-of-arguments) (list nil ...)))
(let* ((--cl-rest-- file) (fieldname ...) (filename ...) (mime-type ...) (data ...)) (http-post-bound-field (format "Content-Disposition: form-data; name=%S; filename=%S" fieldname filename) (format "Content-type: %s" ...) "" data))
(progn (let* (... ... ... ... ...) (http-post-bound-field ... ... "" data)))
(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" ...) "" data))
(lambda (file) (destructuring-bind (fieldname filename mime-type data) file (http-post-bound-field ... ... "" data)))("data")...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment