šŸ“„ primereact/fileupload

File: fileupload.md | Updated: 11/15/2025

Source: https://primereact.org/fileupload/

Introducing PrimeReact v11 Alpha 🄁Learn More

FileUpload

FileUpload is an advanced uploader with dragdrop support, multi file uploads, auto uploading, progress tracking and validations.

Import#


import { FileUpload } from 'primereact/fileupload';
         

Copy

Basic#


FileUpload basic mode provides a simpler UI as an alternative to default advanced mode.

Choose

<Toast ref={toast}></Toast>
<FileUpload mode="basic" name="demo[]" url="/api/upload" accept="image/*" maxFileSize={1000000} onUpload={onUpload} />
         

Copy

Auto#


When auto property is enabled, a file gets uploaded instantly after selection.

Browse

<Toast ref={toast}></Toast>
<FileUpload mode="basic" name="demo[]" url="/api/upload" accept="image/*" maxFileSize={1000000} onUpload={onUpload} auto chooseLabel="Browse" />
         

Copy

Advanced#


FileUpload is an advanced uploader with dragdrop support, multi file uploads, auto uploading, progress tracking and validations.

ChooseUploadCancel

Drag and drop files to here to upload.

<FileUpload name="demo[]" url={'/api/upload'} multiple accept="image/*" maxFileSize={1000000} emptyTemplate={<p className="m-0">Drag and drop files to here to upload.</p>} />
         

Copy

Template#


Uploader UI can be customized with templating.

Ā Ā Ā 

0 B / 1 MB

Drag and Drop Image Here

<Toast ref={toast}></Toast>

<Tooltip target=".custom-choose-btn" content="Choose" position="bottom" />
<Tooltip target=".custom-upload-btn" content="Upload" position="bottom" />
<Tooltip target=".custom-cancel-btn" content="Clear" position="bottom" />

<FileUpload ref={fileUploadRef} name="demo[]" url="/api/upload" multiple accept="image/*" maxFileSize={1000000}
    onUpload={onTemplateUpload} onSelect={onTemplateSelect} onError={onTemplateClear} onClear={onTemplateClear}
    headerTemplate={headerTemplate} itemTemplate={itemTemplate} emptyTemplate={emptyTemplate}
    chooseOptions={chooseOptions} uploadOptions={uploadOptions} cancelOptions={cancelOptions} />
         

Copy

Custom Upload#


Uploading implementation can be overriden with customUpload property and defining a custom uploadHandler function.

Choose

<FileUpload mode="basic" name="demo[]" url="/api/upload" accept="image/*" customUpload uploadHandler={customBase64Uploader} />
         

Copy

Accessibility#


Screen Reader

FileUpload uses a hidden native input element with type="file" for screen readers.

Keyboard Support

Interactive elements of the uploader are buttons, visit the Button accessibility section for more information.

  • Import

  • Basic

  • Auto

  • Advanced

  • Template

  • Custom Upload

  • Accessibility

PrimeReact 10.9.7 by PrimeTek