aguidrevitch/jquery-file-upload-middleware — pull request #59 by derjust (2014-10-08 18:31:41+00:00)
Title: Avoid Concurrent file uploads resulting in the same file version

Hi all,
we spotted a issue with the way how the file version is calculated while a lot of clients (>10) uploading small files in parallel:

The `safeName()` method creates correctly a new file version name but does not touches the 'calculated' file name. Plus the 'begin' event is fired later on.
This mean if a second `fileBegin` event is at the very same position and is executed (before the 'begin' of the first request is handled) the second `safeName()` calculates the very same version.

To avoid this, i added an `touch` for the created file.

This solution is fine for one process working on a upload folder. But we have many node processes handling requests (behind an IIS via iisnode) therefore even that `touch`ing might not be possible as two processes reach that code in the very same moment (assuming a multicore system).

Therefore an option `prefixUuid` has been created to allow the files to be created with a prefix. This new name is returned to the client as the versionized file name would be, too.