我正在尝试上传文件,但是上传屏幕只是保持打开状态,因此我无法在屏幕的一半上查看。有人知道解决方法吗? 我使用的代码:
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);
我尝试添加:$('#uploadButton')。click();但它会引发错误。
此问题与我之前的问题有关:Are you able to upload a file
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>