 
     @emit "totaluploadprogress", totalUploadProgress, totalBytes, totalBytesSent
 
-
+  # @options.paramName can be a function taking one parameter rather than a string.
+  # A parameter name for a file is obtained simply by calling this with an index number.
+  _getParamName: (n) ->
+    if typeof @options.paramName is "function"
+      @options.paramName n
+    else
+      "#{@options.paramName}#{if @options.uploadMultiple then "[]" else ""}"
 
   # Returns a form that can be used as fallback if the browser does not support DragnDrop
   #

    # Finally add the file
    # Has to be last because some servers (eg: S3) expect the file to be the
    # last parameter
    for i in [0..files.length-1]
      pn = @options.paramName
      pnVal = if typeof pn is "function" then pn i else "#{pn}#{if @options.uploadMultiple then "[]" else ""}"
      formData.append pnVal, files[i], files[i].name

    xhr.send formData


  # This code has to pass in IE7 :(
  getFallbackForm: ->
    return existingFallback if existingFallback = @getExistingFallback()

    fieldsString = """<div class="dz-fallback">"""
    fieldsString += """<p>#{@options.dictFallbackText}</p>""" if @options.dictFallbackText
    fieldsString += """<input type="file" name="#{@_getParamName 0}" #{if @options.uploadMultiple then 'multiple="multiple"' } /><input type="submit" value="Upload!"></div>"""

    fields = Dropzone.createElement fieldsString
    if @element.tagName isnt "FORM"
