PrimeNg File Upload

UI Components for Angular
Post Reply
quekqh
Posts: 7
Joined: 19 Jul 2018, 12:15

19 Jul 2018, 12:21

Hi,

I have enabled file upload to accept more file types. When images are uploaded, a thumbnail is shown. However, I'm not sure how to go about adding a thumbnail for documents that are not images, it just shows blank. Anyone knows the solution?

Code: Select all

<p-fileUpload name="myfile[]" id="file" multiple="multiple" chooseLabel="Add" [showCancelButton]="false" [showUploadButton]="false"
                                    accept="image/*,application/*" maxFileSize="1000000" (onSelect)=onSelect($event)>
                                    <div class="ui-fileupload-row" *ngFor="let file of files; let i = index;">
                                        <div *ngIf="!checkImage(file)">
                                                <div><img alt="assets/images/fileIcon.png" width="50"></div>
                                        </div>
                                    </div>
                                </p-fileUpload>

padagalingam
Posts: 9
Joined: 14 Dec 2018, 09:04

14 Dec 2018, 12:42

I achieved using scss. please refer the code.

.ui-fileupload {

.ui-fileupload-content {

.ui-fileupload-row > div:first-child:empty:after {
content: url(imagePath);;
}
}
}

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests