Socket
Socket
Sign inDemoInstall

@99xt/react-fileupload

Package Overview
Dependencies
22
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @99xt/react-fileupload

react-fileupload React component


Version published
Weekly downloads
7
increased by75%
Maintainers
5
Install size
5.49 MB
Created
Weekly downloads
 

Readme

Source

@99xt/react-fileupload

npm (scoped) license

Simpler file upload implementation for react.js apps.

Installation

To install this library, run:

npm install @99xt/react-fileupload --save

Usage

example.component.js

import React, {Component} from 'react';
import FileUpload from '@99xt/react-fileupload';

class ExampleApp extends Component {
  onUploadFiles(evt) {
    if (evt.error) {
        throw evt.error;
    }

    const files = evt.files;
    // You can run upload script here
    console.log(files);
  }

  render() {
    const allowedTypes = [];
    const allowedSize = 15; // MB
    const multiple = true;

    return (
      <div>
        <h1>react-fileupload Demo</h1>

        { /* with default UI */ }
        <FileUpload
          allowedTypes={ allowedTypes }
          allowedSize={ allowedSize }
          multiple={ multiple }
          onUploadFiles={ this.onUploadFiles }
        />

      { /* with custom UI */ }
      <FileUpload
          allowedTypes={allowedTypes}
          allowedSize={allowedSize}
          multiple={multiple}
          onUploadFiles={this.onUploadFiles}
          renderUI={props => {
            const { status } = props;
            return (
              <div style={{ border: "2px dashed #ccc", padding: "50px" }}>
                <p>Click or drag n drop your file(s) here.</p>
                <p>Drag n drop status: {status}</p>
              </div>
            );
          }}
        />
      </div>
    );
  }
}

Contributing Guide

Setting up the development environment

Clone the repository to your workstation

git clone git@github.com:99xt/react-fileupload.git

Navigate to the project directory

cd react-fileupload
npm install
npm run build

Use npm run clean for delete built resources.

Run Demo app

npm start

Demo app will start on http://localhost:3000

Publish to NPM

Update the version in package.json;

npm publish

License

MIT

Keywords

FAQs

Last updated on 27 Oct 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc