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.
<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>
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);
}
};
3 Answer(s)
-
0
Hi,
You can check the sample controller, <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/DemoUiComponentsController.cs#L24">https://github.com/aspnetzero/aspnet-ze ... ler.cs#L24</a>.
You can create a similar controller for your use case and save received files into a path you want.
-
0
Hi I'm getting 404 error for <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/DemoUiComponentsController.cs#L24">https://github.com/aspnetzero/aspnet-ze ... ler.cs#L24</a> . Already added git user name in <a class="postlink" href="https://aspnetzero.com/LicenseManagement">https://aspnetzero.com/LicenseManagement</a> .
-
0
Hi,
It seems liek you haven't accepted the invitation yet. Please visit this address to accept invitation <a class="postlink" href="https://github.com/orgs/aspnetzero">https://github.com/orgs/aspnetzero</a> while you are logged in on github.