简体   繁体   中英

how to pre upload file in p-fileupload

In my project, I am facing such a situation that i have pre upload one file and show to user,

 <p-fileUpload name="File" #fileUpload customUpload="true" *ngIf="!progress" [files]="uploadMoodelFiles" 
                    (onError)="onError($event)" (onSelect)="onSelect($event)" (onBeforeUpload)="onBeforeUpload()"
                    [showUploadButton]="false" (onClear)="onClear($event)" cancelButtonTitle="Cancel file"></p-fileUpload>

i tried get the file which user uploaded previously and stored in one local variable with onselect function,now i have to preupload the file in the uploader again when user come back,i do not know how,can anyone help.. Thanks in advance

Create file upload instance to access it's files property

@ViewChild('fileUpload') fileUpload: FileUpload;

Then assign to uploadMoodelFiles variable with this.fileUpload.files

Demo here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM