Primeng: File upload doesn't show content template

Created on 10 Aug 2017  路  7Comments  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior
In previous versions we had fully functional file upload template set up. In current version template with type "content" is not showing by default, is only shown selecting a file when auto is not enabled, is showed during file upload, but again removed after file upload is completed. This issue is present even when copying your "advanced" example and running using most recent version (4.1.2). Array with uploaded files is fine.

Expected behavior
Template is being shown as demonstrated on your showcase page.

Minimal reproduction of the problem with instructions

Don't know any server accepting upload requests from pluncker (CORS), so I am only pasting code which fails against our server and Apiary as well.

  <p-fileUpload name="demo[]"
                url="...removed..."
                (onUpload)="onUploadExample($event)"
                multiple="true"
                accept="image/*"
                maxFileSize="1000000"
  >
    <ng-template pTemplate type="content">
      <div style="color: red">content</div>
      <ul *ngIf="uploadedFilesExample.length">
        <li *ngFor="let file of uploadedFilesExample">{{file.name}} - {{file.size}} bytes</li>
      </ul>
    </ng-template>
  </p-fileUpload>
  uploadedFilesExample: any[] = [];
...
  onUploadExample(event: any): void {
    for (let file of event.files) {
      this.uploadedFilesExample.push(file);
    }
  }

It is mostly your example with only minor changes (names and added div to template to view when it is actually being present).

Please tell us about your environment:

Kubuntu LTS 16.04, IntelliJ IDEA, npm, webpack (I don't think anything is relevant.)

  • Angular version: 4.1.3

  • PrimeNG version: 4.1.2

  • Browser: Chromium 59, Firefox 54

  • Language: TypeScript 2.4.1

  • Node (for AoT issues): node --version = 7.7.3

All 7 comments

<ng-template pTemplate="content">

Why are you closing this? I have not confirmed whether it works, and it doesn't work. Also even if it would have worked it would still be an issue, because your docs would be wrong.

Am I supposed to open another ticket? I don't get it...

@cagataycivici This fix did not work for me. Any other options?

you need to use: