 
     isFinalized: -> @__finalized
 
+    __initAsSingle: ->
+      @__singleFileDf = $.Deferred()
+      @__progressState = 'uploading'
+      @__uploadDf.done =>
+        @__progressState = 'uploaded'
+        @__singleFileDf.notify @__progressInfo()
+      @__infoDf.done (info) =>
+        @__progressState = 'ready'
+        @__singleFileDf.notify @__progressInfo()
+        @__singleFileDf.resolve info
+      fail = (err) =>
+        @__buildInfo (info) =>
+          @__singleFileDf.reject err, info
+      @__infoDf.fail fail
+      @__uploadDf.fail fail
+
     __progressInfo: ->
       progress = 0
       for file in @__files
-        progress += (@__fileProgresses[file] or 0) / @__files.length
+        progress += ($(file).data('progress') or 0) / @__files.length
       state: @__progressState
       uploadProgress: progress
       progress: if @__progressState == 'ready' then 1 else progress * 0.9

      @__uploadDf = $.Deferred()
      @__infoDf = $.Deferred()

      # asSingle() stuff
      @__singleFileDf = $.Deferred()
      @__progressState = 'uploading'
      @__uploadDf.done =>
        @__progressState = 'uploaded'
        @__singleFileDf.notify @__progressInfo()
      @__infoDf.done (info) =>
        @__progressState = 'ready'
        @__singleFileDf.notify @__progressInfo()
        @__singleFileDf.resolve info
      fail = (err) =>
        @__buildInfo (info) =>
          @__singleFileDf.reject err, info
      @__infoDf.fail fail
      @__uploadDf.fail fail

      @__fileProgresses = {}

    # check if two groups contains same files in same order
    equal: (group) ->

        @onFileRemoved.fire file

    save: ->
      unless @__finalized
        @__finalize()
        @__uploadDf.done =>
          @__createGroup()
            .done (groupInfo) =>
              @__uuid = groupInfo.group_id
              @__buildInfo (info) =>
                if @settings.imagesOnly && !info.isImage
                  @__infoDf.reject('image', info)
                else
                  @__infoDf.resolve(info)
            .fail =>
              @__infoDf.reject('info')

    cancel: =>
      @__finalize()
