Skip to content

A component that helps you to build a file uploader very easily.

License

Notifications You must be signed in to change notification settings

Ggayane/react-file-loader

Repository files navigation

react-file-loader

This component helps you to build a file uploader very easily. You just need to have a file input in your application and give a file to File uploader component and it will done the "dirty" work for you 😏

How to get started ?

Install

npm install

Start

npm start

Installation

The easiest way to use react-file-loader is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).

npm install react-file-loader --save

Usage

import FileLoader from 'react-file-loader';

<FileLoader
  file={this.state.file || null}
  requestSuccessParam='status'
  requestSuccessVal='ok'
  url={'your link here'} />

see more in examples

Props

Name Default Type Description
file? object uploaded file
url? string url to upload a file
preventReload? false boolean show alert dialog on page reload while file is uploading
requestSuccessParam? string uploaded response param for checking
requestSuccessVal? string successfully upload response param value
validFileTypes? ['image/jpeg', 'image/png', 'video/mp4'] array valid file types
fileMaxSize? 1024 number uploaded file maximum size
uploadFinishedCallback? function function to call after file upload is done
additionalData? object additional data to send with the file: {firstName: 'John'}

Screenshot

0.0.1

About

A component that helps you to build a file uploader very easily.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published