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.

Reply via email to