react-file-loader

1.2.3 • Public • Published

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-input-validation';
 
<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

Package Sidebar

Install

npm i react-file-loader

Weekly Downloads

4

Version

1.2.3

License

MIT

Last publish

Collaborators

  • ggayane