     check proceedAfterUpload, Match.Optional Boolean
 
     fileId   = opts.fileId or Random.id()
-    FSName   = if @namingFunction then @namingFunction() else fileId
+    FSName   = if @namingFunction then @namingFunction(opts) else fileId
     fileName = if (opts.name or opts.fileName) then (opts.name or opts.fileName) else FSName
 
     {extension, extensionWithDot} = @_getExt fileName

    result.ext       = extension
    result._id       = opts.fileId
    result.userId    = userId or null
    result.path      = "#{@storagePath(result)}#{nodePath.sep}#{opts.FSName}#{extensionWithDot}"
    result           = _.extend result, @_dataToSchema result


    self      = @
    opts     ?= {}
    fileId    = opts.fileId or Random.id()
    FSName    = if @namingFunction then @namingFunction(opts) else fileId
    pathParts = url.split('/')
    fileName  = if (opts.name or opts.fileName) then (opts.name or opts.fileName) else pathParts[pathParts.length - 1] or FSName

