Upload modal will not close after filepath is sent

2019-04-12 05:14发布

问题:

I'm attempting to upload a file, which it does, however the upload screen just stays open so I cannot view on half the screen. Anyone know a workaround? The code I use:

        var path = require('path');
         //the file to upload
        var fileToUpload = 'some path i put in',
          //this is variable that inserts the path to find file to upload
          absolutePath = path.resolve(__dirname, fileToUpload);
         //inserts the path
        $('input[type="file"]').sendKeys(absolutePath);

I've tried adding: $('#uploadButton').click(); however it throws errors.

This question is related to my previous questions here: Are you able to upload a file

The html:

<div id="uploadLogoDialog" class="modal-dialog" style="">
  <div class="upload-overlay"></div>
  <div class="upload-logo-container">
    <div class="upload-logo-header">Image must be under 50 MB and in the following formats: .JPG, .GIF, .PNG</div>
    <div class="upload-logo-content">
      <div class="select-container">
        <button class="btn btn-select" data-bind="click: assosiateLogoImage">
          <span class="icon icon-select"></span>
          <span class="label">Select file</span>
        </button>
        <form id="uploadForm" action="https://iplan.dev.s3.amazonaws.com/" enctype="multipart/form-data" target="uploadIFrame" method="post">
          <div class="file-input" data-bind="css: {'ie': isIE}">
        </form>
        </div>
        <button class="btn btn-upload" data-bind="click: startLogoUpload, disable: logo.isUploaded" disabled="">
          <span class="icon icon-upload"></span>
          <span class="label">Upload</span>
        </button>
        <button class="btn btn-ok" data-bind="click: closeUploadLogoDialog">
          <span class="label">OK</span>
        </button>
        <div class="upload-progress-container">
          <div class="upload-progress" style="display: none;" data-bind="visible: isUploading">
            <div class="progress-bar ui-progressbar ui-widget ui-widget-content ui-corner-all" data-bind="progressBar: { value: progressValue }" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">
              <div class="ui-progressbar-value ui-widget-header ui-corner-left" style="display: none; width: 0%;"></div>
            </div>
            <div class="percentage" data-bind="text: progressValue() + ' %'">0 %</div>
          </div>
        </div>
      </div>
    </div>
    <div class="upload-busy" data-bind="visible: isUploading" style="display: none;"></div>
  </div>