Hello,

I would like to open an excel file from multipart data without saving
it (forbidden by Google Appengine). I have adapted the incanter's
read-xls which reads from actual files to read-xls-stream which takes
an object of the same kind that with-open provides.

I wanted to write something like the following but I get the error
message: "clojure.lang.PersistentVector cannot be cast to
java.lang.String". I don't really understand the mismatch and how to
convert one type to the other...

(use [appengine-magic.multipart-params :only (wrap-multipart-params)])

(defn retailer-stock-update []
  (wrap-multipart-params
   (fn [req]
     (let [xls (get (:params req) "stock-xls")]
       (with-in-str [str (:bytes xls)]
         (read-xls-stream str))))))

As far as I have understood, (:bytes xls) is seen as a java byte
array, since (class (:bytes xls)) displays "class [B", but I don't get
how it is related to the previous error message. I guess I sould
manually convert (:bytes xls) to the type with-in-str wants but I
don't know how.

I have given a look to
http://code.google.com/appengine/kb/java.html#fileforms but I guess
clojure can do without explicit call to FileItemStream and
FileItemIterator. Anyway, I didn't manage to deal with it either.

Could you give me a clue?

Thanks in advance,

Vincent

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to