IMCE file upload dynamic path problem I am trying to setup a filefield using imce to allow the user to upload files however I am having problems setting it up trying to get a unique folder for each node.

So for example I have set the imce directory path to

php: return $user-&gt;name.'/'.date('Y-m-d-H-i');


Which will upload files to user/2015-06-12-13-15.

However when the I click use the file browser if I don't upload the file within the same minute as when I clicked use the file browser, IMCE throws an error saying the directory doesn't exist as I imagine the date change throws off the upload.

I don't want to restrict users creating one node an hour so does anyone know of another way of generating random file paths for each node?
This probably isn't the best solution, however it is working for me at the moment.  

Using the following php in the IMCE directory path it generates the same random number for 5 minutes.  So I can have the directory structure user/Y-m-d-H-[random number]

php: function random() {  $seed = floor(time()/(60*5)); srand($seed); $item = rand(0,100); return $item; }  return $user-&gt;name.'/'.date("Y-m-d-H").'-'.random();