From b6494feb8c1654b30aa7caf5359530bd68042589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay=20=C3=87ivici?= Date: Sat, 9 Sep 2017 13:54:12 +0300 Subject: [PATCH] Documentation for FileUpload --- src/showcase/fileupload/FileUploadDemo.js | 127 ++++++++++++++++------ 1 file changed, 93 insertions(+), 34 deletions(-) diff --git a/src/showcase/fileupload/FileUploadDemo.js b/src/showcase/fileupload/FileUploadDemo.js index 426d6599a9..19389ffe83 100644 --- a/src/showcase/fileupload/FileUploadDemo.js +++ b/src/showcase/fileupload/FileUploadDemo.js @@ -48,14 +48,14 @@ export class FileUploadDemo extends Component {

Advanced

-

Basic

- +

Basic with Auto

- +
@@ -85,55 +85,54 @@ import {FileUpload} from 'primereact/components/fileupload/FileUpload';

FileUpload requires a url property as the upload target and a name to identify the files at backend.

{` - - -`} - - -{` -constructor() { - super(); - this.state = {}; - this.onUpload = this.onUpload.bind(this); -} - -onUpload(event) { - .... -} + `}

Multiple Uploads

-

Only one file can be selected at a time, to allow selecting multiples enable multiple option.

+

Only one file can be selected at a time by default, to allow selecting multiple files at once enable multiple option.

{` - + `}

DragDrop

-

File selection can also be done by dragging and dropping one or more to the content section of the component.

+

File selection can also be done by dragging and dropping from the filesystem to the content section of the component.

+ +

Auto Uploads

+

When auto property is enabled, upload begins as soon as file selection is completed or a file is dropped on the drop area.

+ + +{` + + +`} +

File Types

Selectable file types can be restricted with accept property, example below only allows images to be uploaded. Read more about other possible values here.

+ +{` + + +`} +

File Size

Maximium file size can be restricted using maxFileSize property defined in bytes.

+ {` - + `} -

In order to customize the default messages use invalidFileSizeMessageSummary and invalidFileSizeMessageDetail options. In summary {0} placeholder refers to the filename and in detail, file size.

- +

In order to customize the default messages use invalidFileSizeMessageSummary and invalidFileSizeMessageDetail options. In summary messages, {0} placeholder refers to the filename and in detail message, the file size.