🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rc-upload

Package Overview
Dependencies
Maintainers
6
Versions
140
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.2
latest
Source
npm
Version published
Weekly downloads
1.8M
3.17%
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 27 May 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