- 现在我想做一个多文件上传的功能
2.
<div class="main">
<div class="left">
<div>File List:</div>
<div id="files">
<ul style="margin:0;padding:0">
<li *ngFor="let item of files" pDraggable="filesTo"
(onDragStart)="dragStart($event,item)" (onDragEnd)="dragEnd($event)" (click)="doPreview(item)">
<p>{{item.filename}}</p>
</li>
</ul>
</div>
</div>
<div class="right">
<div>Drop file from List or <a href="javascript:void(0)" (click)="fileSelect.click()">browse</a> local file:</div>
<input id="fileSelect" #fileSelect style="display:none" type="file" ng2FileSelect [uploader]="uploader" (change)="selectedFileOnChanged($event)" multiple />
<div class="select_file" pDroppable="filesTo"
(onDrop)="drop($event)" [ngClass]="{'ui-highlight-car':draggedFile}"
ng2FileDrop (onFileDrop)="fileDropOver($event)" [uploader]="uploader">
<div class="selected" *ngFor="let selItem of selectedFiles">
<div class="file_close" (click)="removeFile($event,selItem)">X</div>
<div class="file_name">{{selItem.filename}}</div>
</div>
</div>
</div>
<div class="clr"></div>
<button class="btn" (click)="doUpload()">Save</button>
</div>
3.目前的问题是:我的selectedFileOnChanged($event)这个方法,在ts文件中用event.target.files取得的内容一直是空
另外,我该如何把我上传的和拖拽的文件同时传到java后台,然后后台应该用什么方式去接收我传过去的数据?