This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

Send the new file over HTTP (server part)

4 posts · 5784 views

Hello everyone,

does anybody know how to send the new created file over the web?
I have one script that creates new file. It works fine, but now I need to run this script on the web-server and download generated file via browser.

Thanks for your help and time,
Alex

Re: Send the new file over HTTP (server part)

I don't need to make http requests or web-servers...

I just want to save a file (on client side, via browser) that will be created on the server side (standard output).
The question is how to send the output-stream (in my case it's a file) to standard-output?

Re: Send the new file over HTTP (server part)

The answer is
(format t "Content-Type:application/vnd.ms-excel~%")
(format t "Content-Disposition:attachment;filename=file.xls~%~%")
(princ "Test. Ok!")
But now I have another question: what's wrong with this code?
#!/usr/bin/sbcl --script
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
    (load quicklisp-init)))

(ql:quickload "buildnode-excel")

(format t "Content-Type:application/vnd.ms-excel~%")
(format t "Content-Disposition:attachment;filename=file.xls~%~%")
(princ "Test. Ok!")
After removing (ql:quickload "buildnode-excel") it works...