Hi Jarrod, I tried changing filename to string as follows (defn handle-upload [filename] (upload-file (gallery-path) (add-timestamp (str filename))) (resp/redirect "/upload"))
and still got an error as: java.lang.NullPointerException My entire file code is: (ns pgapp.routes.upload (:require [compojure.core :refer [defroutes GET POST]] [pgapp.views.layout :as layout] [noir.io :refer [upload-file resource-path]] [noir.session :as session] [noir.response :as resp] [noir.util.route :refer [restricted]] [clojure.java.io :as io] [ring.util.response :refer [file-response]] [taoensso.timbre :refer [error]] [pgapp.models.db :as db] [clj-time.core :as time] [clj-time.coerce :as tc] [pgapp.util :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]]) (:import [java.io File FileInputStream FileOutputStream] javax.imageio.ImageIO)) (use 'ring.middleware.params 'ring.middleware.multipart-params) (defn upload-page [info] (layout/render "upload.html")) (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 (str filename))) (resp/redirect "/upload")) (defroutes myapp-routes (GET "/upload" [info] (upload-page {:info info})) (POST "/upload" [file] (handle-upload file))) I changed filename to (str filename) in the handle-upload function, but still no dice :( The :refer [galleries gallery-path thumb-uri thumb-prefix unique-prefix]]) are just references to file paths in util.clj vs hardcoding them. I got productive with clojure ref routes, sessions, views with selmer and queries either raw or with korma all easy peasy. However this one thing, this file upload issue has thrown me for a loop for 3 days now :) It is the bane of my existence right now :) If I can get a handle on it, am considering creating a library to make this easier akin to file upload plugins in ruby world like carrier-wave. Thanks for any pointers on what I'm doing wrong with the above code. -- -- 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.