Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-upload

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload

upload ui component for react

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
792K
decreased by-42.26%
Maintainers
1
Weekly downloads
 
Created

What is rc-upload?

The rc-upload npm package is a React component for uploading files. It allows users to upload files via drag and drop, or by using a file input. It supports multiple file uploads, progress feedback, and custom upload triggers.

What are rc-upload's main functionalities?

File Upload

This feature allows users to upload files to a specified server endpoint. The 'action' property defines the URL to which the files will be uploaded. The 'onChange' callback provides file status updates.

import Upload from 'rc-upload';

const props = {
  action: '//jsonplaceholder.typicode.com/posts/',
  onChange({ file, fileList }) {
    if (file.status !== 'uploading') {
      console.log(file, fileList);
    }
  },
  defaultFileList: [],
};

<Upload {...props}>
  <button>Click to Upload</button>
</Upload>

Drag and Drop

This feature enables drag-and-drop file uploads. The 'type' property is set to 'drag' to enable this functionality. The 'accept' property can be used to restrict the file types that can be uploaded.

import Upload from 'rc-upload';

const props = {
  action: '//jsonplaceholder.typicode.com/posts/',
  type: 'drag',
  accept: '.png',
  beforeUpload(file) {
    // Perform file validation or other operations before upload
    return true;
  },
  onDrop(e) {
    console.log('Dropped files', e.dataTransfer.files);
  }
};

<Upload {...props}>
  <p>Drag files here to upload</p>
</Upload>

Progress Feedback

This feature provides feedback on the progress of the file upload. The 'onProgress' callback is called during the upload process and provides information about the current progress.

import Upload from 'rc-upload';

const props = {
  action: '//jsonplaceholder.typicode.com/posts/',
  onProgress(step, file) {
    console.log('Upload progress:', step.percent, 'File:', file.name);
  }
};

<Upload {...props}>
  <button>Click to Upload</button>
</Upload>

Other packages similar to rc-upload

Keywords

FAQs

Package last updated on 24 Jun 2015

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