Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defroute ("/" :method :POST) (&key _parsed)
- (format t "Datos: ~a~%" (car _parsed)) ;; ((nombre #<VECTOR-INPUT-STREAM {10050DE253}> 139400666_255363712867314_6646264800366846945_n.jpg image/jpeg))
- (format t "First: ~a~%" (first (car _parsed))) ;; nombre
- (format t "Second: ~a~%" (second (car _parsed))) ;; #<VECTOR-INPUT-STREAM {10050DE253}>
- (format t "Third: ~a~%" (third (car _parsed))) ;; 139400666_255363712867314_6646264800366846945_n.jpg
- (format t "Fourht: ~a~%" (fourth (car _parsed))) ;; image/jpeg
- ;;(format t "*request*: ~a~%~%" *request*)
- (let ((uploaded-file-buffer (second (car _parsed)))
- ;;(buffer (make-array 50 :adjustable t :fill-pointer 5))
- (file-name (format nil "static/~a" (third (car _parsed)))))
- (format t "File name: ~a~%" file-name)
- (with-open-file (file-stream file-name :direction :output :if-exists :supersede :element-type '(unsigned-byte 8))
- (loop :with byte
- :while (setf byte (read-byte uploaded-file-buffer nil))
- :do (write-byte byte file-stream))))
- ;;(uiop:copy-stream-to-stream uploaded-file-buffer file-stream))
- ;;(read-sequence buffer uploaded-file-buffer)
- ;;(format "Output sequence: ~a~%" buffer))
- ;; (with-open-file (file-stream file-name :direction :output :if-exists :supersede :element-type '(unsigned-byte 8))
- ;(let ((buffer (make-array 50 :adjustable t :fill-pointer 5))
- ; (file-name (format nil "static/~a" (third (car _parsed)))))
- ; (read-sequence buffer (request-raw-body *request*))
- ; (format t "Datos convertidos: ~a~%" (flex:octets-to-string buffer))
- ; (loop for elemento across buffer
- ; do
- ; (write-sequence elemento file-stream)))
- ; (format t "Dato leido: ~a~%" buffer))
- (redirect "/"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement