3

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>
Community
  • 1
  • 1
Nicole Phillips
  • 753
  • 1
  • 18
  • 41
  • Could you please share a screenshot of the problem? Also, provide the `input` element HTML representation. Thanks. – alecxe Sep 11 '15 at 16:01
  • @alecxe I updated the question with a related previous question I had asked awhile back – Nicole Phillips Sep 11 '15 at 16:07
  • @alecxe I'm not sure where the input element comes from I just copied this code from a suggestion and it has worked, I'm assuming it works directly with the windows upload modal and not the html itself. – Nicole Phillips Sep 11 '15 at 16:08
  • Ok, do you still click the upload button? Would be good to see the complete code you have so far to have a clear picture. – alecxe Sep 11 '15 at 16:08
  • @alecxe I added the html. It does not seem to slick the 'open' button when my file system modal opens, however it still links the file and it is uploaded. – Nicole Phillips Sep 11 '15 at 16:15
  • It probably has something to do with firing the javascript events (startLogoUpload, closeUploadLogoDialog). With the automation hitting the input field, it might not trigger those things to happen properly. – martin770 Dec 22 '15 at 19:35

0 Answers0