     ).always( ->
       toggleIcon()
     )
+
+  selectFiles : (event) ->
+
+    if event.target.files.length
+      @ui.uploadAndExploreForm.submit()
+
+
+  uploadFiles : (event) ->
+
+    event.preventDefault()
+
+    toggleIcon = =>
+
+      [@ui.formSpinnerIcon, @ui.formUploadIcon].forEach((ea) -> ea.toggleClass("hide"))
+
+
+    toggleIcon()
+
+    form = @ui.uploadAndExploreForm
+
+    $.ajax(
+      url : form.attr("action")
+      data : new FormData(form[0])
+      type : "POST"
+      processData : false
+      contentType : false
+    ).done( (data) ->
+      nml = data.annotation
+      Toast.message(data.messages)
+    ).fail( (xhr) ->
+      Toast.message(xhr.responseJSON.messages)
+    ).always( ->
+      toggleIcon()
+    )

    @merge(url)

  mergeNml : ->
    console.log("mergeNml")


  destroyModal : ->


    "click #task-type-merge"   : "mergeTaskType"
    "click #project-merge"     : "mergeProject"
    "click #nml-merge"         : "mergeNml"
    "change input[type=file]"         : "selectFiles"
    "submit @ui.uploadAndExploreForm" : "uploadFiles"
    "click #explorativs-merge" : "mergeExplorativs"

