You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

rc-upload

Package Overview
Dependencies
Maintainers
6
Versions
141
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

4.9.0
lastest
Source
npmnpm
Version published
Weekly downloads
1.8M
4.2%
Maintainers
6
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

react

FAQs

Package last updated on 10 Apr 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.