New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-dropzone-uploader

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dropzone-uploader

React file dropzone and uploader: fully customizable, progress indicators, upload cancellation and restart, zero deps

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Dropzone Uploader

NPM npm bundle size (minified + gzip)

React Dropzone Uploader is a customizable file dropzone and uploader, with progress indicators, upload cancellation and restart, and minimal dependencies.

Features

  • Fully controllable via optional props, callbacks, and component injection API
  • Rich file metadata and file previews, especially for image, video and audio files
  • Detailed upload status and progress, upload cancellation and restart
  • Trivially set auth headers and additional upload fields for any upload (see S3 example)
  • Modular design allows for use as standalone file dropzone, file picker, file uploader
  • Easily customizable and themeable
  • Lightweight at ~15kB, including styles

Installation

Run npm install --save react-dropzone-uploader.

Getting Started

RDU's sensible defaults make it very powerful out of the box. The following code gives your users a dropzone and file picker that uploads files to https://httpbin.org/post, with a button to submit the files when they're done.

The onChangeStatus prop is thrown in just to show the status values a file is assigned as it's dropped or chosen and then uploaded. Check out a live demo here.

import Dropzone from 'react-dropzone-uploader'

const Uploader = () => {
  const getUploadParams = ({ meta }) => { // upload `url` and other upload params can be a function of file `meta`
    const url = 'https://httpbin.org/post'
    const fileUrl = `${url}/${encodeURIComponent(meta.name)}` // new value can be merged into file meta
    return { url, meta: { fileUrl } }
  }

  const handleSubmit = (files) => { // array of all files that are done uploading
    console.log(files.map(f => f.meta))
  }

  const handleChangeStatus = ({ meta, file }, status) => { // invoked every time a file's `status` changes
    console.log(status, meta, file)
  }

  return (
    <Dropzone
      getUploadParams={getUploadParams}
      onChangeStatus={handleChangeStatus}
      onSubmit={handleSubmit}
    />
  )
}

Keywords

FAQs

Package last updated on 30 Oct 2018

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc