 
           @reset() if item is lastItem
 
+  readDirectory: (dirEntry, callback, error)->
+
+    callback.files  or= []
+    callback.i = 0
+
+    dirReader = dirEntry.createReader()
+    relative  = dirEntry.fullPath.replace(/^\//, "").replace /(.+?)\/?$/, "$1/"
+
+    dirReader.readEntries (entries)=>
+      for entry in entries
+        callback.i++
+        if entry.isFile
+          entry.file (file)->
+            file.relativePath = relative + file.name
+            callback.files.push file
+        else
+          @readDirectory entry, callback, error
+      if entries.length is callback.i
+        callback callback.files
+    , error
+
   setPath: (@path=@options.defaultPath)->
     {uploadToVM, title} = @getOptions()
     @updatePartial """

          continue
        reader = new FileReader
        reader.onloadend = do (file=files[index])=> (readEvent)=>
          if @getOptions().uploadToVM
            fsFile = @upload file.name, readEvent.target.result
          @emit "dropFile",
            origin  : "external"
            filename: file.name
            instance: fsFile
            content : readEvent.target.result
            isLast  : file is lastFile

      You can archive your files and try again.
      """

    if items?.item?(0)?.webkitGetAsEntry
      for item in items
        entry = item.webkitGetAsEntry()
        if entry.isDirectory
          @readDirectory entry.filesystem.root, (files)=>
            @uploadFiles files, event
          , =>
            @uploadFiles files, event
        else if entry.isFile
          entry.file (file)=>
            @uploadFiles [file], event
    else
      @uploadFiles files, event

  uploadFiles: (files, event)->
    @_uploaded or= {}
    if files?.length

      lastFile = files.last

      for file, index in files
        sizeInMb = file.size/1024/1024
        if sizeInMb > 100 && @getOptions().uploadToVM
