I am using p-fileupload component in angular, but after uploading one file the button is not allowing click event, need to refresh Page to perform another file upload task. Can you please help how can I upload file without refreshing Page
Please find below html code:
<p-fileupload mode="basic"
[auto]="true"
title="upload file"
(onSelect)="upload_document($event);"
appHide[roles]=GRANT_ALL_GRP>
</p-fileupload>
If you use an array with file(name)s, then after the upload, you can clear the array and then the upload is possible again.
<p-fileUpload
mode="basic"
[auto]="true"
[files]="myFiles"
title="upload file"
name="myfile[]"
[customUpload]="true"
(uploadHandler)="upload_document($event);" >
</p-fileUpload>
In the component:
myFiles: [] = [];
upload_document($event:any){
console.log("Upload",$event);
// UPLOAD LOGIC
this.myFiles = [];
}
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.