I'm trying to use primeng fileupload. But I'm not able to find out how to save the uploaded image on some given path. I get uploadedFiles
object but I'm not able to save the file to a given path.
<p-fileUpload multiple="multiple"
name="DefaultFileUploadFileInput[]"
[url]="uploadUrl"
accept="image/*"
maxFileSize="1000000"
(onUpload)="onUpload($event)">
<ng-template pTemplate="content">
<ul *ngIf="uploadedFiles.length">
<li *ngFor="let file of uploadedFiles">{{file.name}} - {{file.size}} bytes</li>
</ul>
</ng-template>
</p-fileUpload>
Angular Code:
uploadUrl: string;
uploadedFiles: any[] = [];
constructor(
injector: Injector,
private demoUiComponentsService: DemoUiComponentsServiceProxy
) {
super(injector);
this.uploadUrl = AppConsts.remoteServiceBaseUrl + '/DemoUiComponents/UploadFiles';
}
// upload completed event
onUpload(event): void {
for (let file of event.files) {
this.uploadedFiles.push(file);
}
};