michael-e/uniqueuploadfield — pull request #3 by zimmen (2011-11-23 09:55:37+00:00)
Title: Ability to construct file name using reflection

Hi Michael,

This pull request makes it possible to name the uploaded file using other fields in the entry. It works like the [reflection field](https://github.com/rowan-lewis/reflectionfield) by @rowan-lewis (borrowed some code too).

In the section manager, i added an extra text-input called "expression". This expression constructs the filename using Xpath.

### Example:
Section: Ideabox

Fields:

- TextInput: name
- Selectbox Link: Department
- UniqueUpload: Idea

In the expression input of the UniqueUpload field i can enter:

{entry/department}-{entry/name}[{entry/@id}]

When i add a new entry with the name "John", select "HR" as department and upload a word file containing Johns's big idea named "this will be great.doc", the file will be named: HR-John[3].doc (assuming it's new entity id will be 3)

I was in doubt wetter to extend you field for this or not.

##### Why not
It is possible to create an expression that makes it non-unique at all, look at the example, the id is what makes it unique and i could omit that.

##### Why did i do this anyway
I need 100% of the unique upload functionality so i would be duplicating this field, rename it and add stuff to it and that felt weird!

What is your thought in this.