It works for me. I am guessing you are not passing in a string when you are calling (add-timstamp filename). Which is to say that your param 'filename' is a map not a string.
If you are passing in a map of the upload information you need to grab the filename for your let: (let [ext-postion (.lastIndexOf (:filename filename) ".") ...) Hope that helps. On Friday, January 24, 2014 3:31:42 AM UTC-5, The Dude (Abides) wrote: > > Hi, I'm new to clojure and am trying to rename an uploaded file with a > unique identifier such as a long time stamp as follows: > > (defn add-timestamp [filename] > (let [ext-position (.lastIndexOf filename ".") > timestamp (tc/to-long (time/now))] > (if (pos? ext-position) > (str (.substring filename 0 ext-position) > "-" timestamp (.substring filename ext-position)) > (str filename "-" timestamp)))) > > (defn handle-upload [filename] > (upload-file (gallery-path) (add-timestamp filename)) > (resp/redirect "/upload")) > > However the above throws an error as follows: > > java.lang.IllegalArgumentException > No matching method found: lastIndexOf for class > clojure.lang.PersistentArrayMap > > Would appreciate any feedback on what I may be doing wrong in the > add-timestamp function. > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.