     parent : null
 
   events :
-    "change input[type=file]" : "selectFiles"
+    "change.bs.fileinput .fileinput" : "selectFiles"
     "submit @ui.uploadAndExploreForm" : "uploadFiles"
     "click @ui.toggleViewArchivedButton" : "fetchArchivedAnnotations"
     "click @ui.toggleViewOpenButton" : "fetchOpenAnnotations"
     "click @ui.archiveAllButton" : "archiveAll"
 
   ui :
+    fileinput : "#fileinput"
     tracingChooser : "#tracing-chooser"
     uploadAndExploreForm : "#upload-and-explore-form"
+    uploadFileInput : "#upload-and-explore-form input[type=file]"
     formSpinnerIcon : "#form-spinner-icon"
     formUploadIcon : "#form-upload-icon"
     toggleViewArchivedButton : "#toggle-view-archived"

          enctype="multipart/form-data"
          id="upload-and-explore-form"
          class="form-inline inline-block">
          <div class="fileinput fileinput-new" data-provides="fileinput">
            <span class="btn btn-default btn-file">
              <span class="fileinput-new">
                <i class="fa fa-upload" id="form-upload-icon"></i>
                <i class="fa fa-spinner fa-spin hide" id="form-spinner-icon"></i>
                Upload NML & explore
              </span>
              <input type="file" name="nmlFile" multiple accept=".nml">


    event.preventDefault()

    form = @ui.uploadAndExploreForm

    Request.sendMultipartFormReceiveJSON(
      form.attr("action")
      data : new FormData(form[0])
    ).then(
      (data) ->
        url = "/annotations/" + data.annotation.typ + "/" + data.annotation.id
        app.router.loadURL(url)
        Toast.message(data.messages)
      => @ui.fileinput.fileinput("clear")
    )


