Re: Uploading a file to web server using Lisp
- From: nallen05@xxxxxxxxx
- Date: 5 Feb 2007 12:04:53 -0800
On Feb 5, 10:19 am, "Trastabuga" <lisper...@xxxxxxxxx> wrote:
Could anyone point me the direction how I can implement uploading
files from a web browser to a web server using lisp? Any libraries? Is
CGI the only way to accomplish it? There are lots of materials on how
to do it using PHP but I could nothing for Lisp.
Here's an exmple on how to do it with portableaserve http://
www.cliki.net/Portableaserve (from examples.cl included in the
tarball)
http://paste.lisp.org/display/36419
hth
Nick
;; these two urls show how to transfer a user-selected file from
;; the client browser to the server.
;;
;; We use two urls (/getfile to put up the form and /getfile-post to
;; handle the post action of the form). We could have done it all
;; with one url but since there's a lot of code it helps in the
;; presentation to separate the two.
;;
(publish :path "/getfile-old"
:content-type "text/html; charset=utf-8"
:function #'(lambda (req ent) (getfile-function
req ent "/getfile-got-old")))
(publish :path "/getfile"
:content-type "text/html; charset=utf-8"
:function #'(lambda (req ent) (getfile-function
req ent "/getfile-got")))
(defun getfile-function (req ent posturl)
(with-http-response (req ent)
(with-http-body (req ent)
(html (:head "get file")
(:body
((:form :enctype "multipart/form-data"
:method "post"
:action posturl)
"Let me know what file to grab"
:br
((:input :type "file"
:name "thefile"
:value "*.txt"))
:br
((:input :type "text" :name "textthing"))
"Enter some text"
:br
((:input :type "checkbox" :name "checkone"))
"check box one"
:br
((:input :type "checkbox" :name "checktwo"))
"check box two"
:br
((:input :type "submit"))))))))
Any suggestions are welcome!
Andrew
.
- Follow-Ups:
- Re: Uploading a file to web server using Lisp
- From: nallen05
- Re: Uploading a file to web server using Lisp
- From: Trastabuga
- Re: Uploading a file to web server using Lisp
- References:
- Uploading a file to web server using Lisp
- From: Trastabuga
- Uploading a file to web server using Lisp
- Prev by Date: Re: Uploading a file to web server using Lisp
- Next by Date: Re: Uploading a file to web server using Lisp
- Previous by thread: Re: Uploading a file to web server using Lisp
- Next by thread: Re: Uploading a file to web server using Lisp
- Index(es):
Relevant Pages
|