       attributes: href: "#"
       click     : => @emit "cancel"
 
-  saveFile: (uploadFile, data)->
-    @emit "uploadStart", uploadFile
-    uploadFile.saveBinary data, (err, res, progress)=>
+  saveFile: (fsFile, data)->
+    @emit "uploadStart", fsFile
+    fsFile.saveBinary data, (err, res, progress)=>
       return if err
       if res.finished
-        @emit "uploadEnd", uploadFile
+        @emit "uploadEnd", fsFile
       else if res.abort
-        @emit "uploadAbort", uploadFile
+        @emit "uploadAbort", fsFile
       else
-        @emit "uploadFile", uploadFile, progress.percent
+        @emit "uploadFile", fsFile, progress.percent
 
-  upload: (file, data)->
-    modalStack  = KDModalView.createStack lastToFirst: yes
-    uploadDir   = FSHelper.createFileFromPath @path, 'folder'
-    uploadFile  = FSHelper.createFileFromPath "#{@path}/#{file}"
+  upload: (fileName, contents)->
+    modalStack      = KDModalView.createStack lastToFirst: yes
+    fsUploadFolder  = FSHelper.createFileFromPath @path, 'folder'
+    fsFileToUpload  = FSHelper.createFileFromPath "#{@path}/#{fileName}"
 
-    upload      = =>
-      uploadFile.exists (err, exists)=>
-        unless exists
-        then @saveFile uploadFile, data
+    upload = =>
+      fsFileToUpload.exists (err, exists)=>
+        if not exists or fsFileToUpload.getLocalFileInfo().lastUploadedChunk?
+        then @saveFile fsFileToUpload, contents
         else
           modalStack.addModal modal = new KDModalView
             overlay : no
             title   : "Overwrite File?"
             content : """
             <div class="modalformline">
-            You already have the file <code>#{uploadFile.path}</code>. Do you want
+            You already have the file <code>#{fsFileToUpload.path}</code>. Do you want
             to overwrite it?
             </div>
             """

      lastFile = files.last
      for file, index in files
        sizeInMb = file.size/1024/1024
        if sizeInMb > 50 && @getOptions().uploadToVM
          new KDNotificationView
            type    : "tray"
            title   : "File is too big to upload!"

      @on "dragleave", => @unsetClass "hover"
      @on "drop",      => @unsetClass "hover"

    @on "uploadFile", (fsFile, percent)=>
      finder = KD.getSingleton "finderController"
      filePath  = "[#{fsFile.vmName}]#{fsFile.path}"
      finder.treeController.nodes[filePath]?.updateProgressView percent

    @on "uploadStart", (fsFile)=>
      finder = KD.getSingleton "finderController"
      filePath   = "[#{fsFile.vmName}]#{fsFile.path}"
      parentPath = "[#{fsFile.vmName}]#{fsFile.parentPath}"

      fsFile._isBeingUploaded = yes
      nodeView = finder.treeController.nodes[filePath]
      if nodeView
        nodeView.updateProgressView 1
        nodeView.on "abortProgress", => fsFile.abort yes
      else
        finder.treeController.on "NodeWasAdded", (nodeView)->
          if nodeView.getData().path is filePath and fsFile._isBeingUploaded
            nodeView.updateProgressView 1
            nodeView.on "abortProgress", => fsFile.abort yes

        fsFile.save "", -> finder.revealPath parentPath

    @on "uploadEnd", (fsFile)->
      fsFile._isBeingUploaded = no

  reset: ->
    {uploadToVM, defaultPath, title} = @getOptions()
