New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multipart file upload #63
Comments
I see. #6 The version I downloaded from quicklisp did not include include that fix. |
Hi, how do you actually use download and save the file to your local server? |
You could try something like this: (defparameter *file-storage-directory* #p"/var/www/images/")
(defroute ("/upload-image" :method :post) (&key |file|)
(let ((filename (gethash "filename" (second |file|)))
(data (slot-value (first |file|) 'flexi-streams::vector)))
(with-open-file (s (merge-pathnames filename *file-storage-directory*)
:if-does-not-exist :create
:if-exists :supersede :direction :output
:element-type '(unsigned-byte 8))
(write-sequence data s)))
(return-some-result-to-browser))
I'm planning to do something like this in the future (I have not tested it yet): (setf *image-storage*
(make-instance 'disk-storage
:bucket "file-upload-example"
:directory #P"/tmp/attachment/"))
(defroute ("/upload-image" :method :post) (&key |file|)
(let ((filename (gethash "filename" (second |file|)))
(data (first |file|))
(mito-attachment:*storage* *image-storage*))
(mito:create-dao 'image :content data)
(return-some-result-to-browser))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
How does one upload files to caveman2
I have this simple form, but I'm not able to get the contets.
if caveman2 can not do this, can I inject a hunchentoot handler that does that part?
The text was updated successfully, but these errors were encountered: