
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@rc-component/upload
Advanced tools
React Upload
npm install
npm start
online example: https://upload.react-component.vercel.app/
var Upload = require('@rc-component/upload');
var React = require('react');
React.render(<Upload />, container);
| name | type | default | description |
|---|---|---|---|
| name | string | file | file param post to server |
| style | object | {} | root component inline style |
| className | string | - | root component className |
| disabled | boolean | false | whether disabled |
| component | "div" | "span" | "span" | wrap component name |
| action | string | function(file): string | Promise<string> | form action url | |
| method | string | post | request method |
| directory | boolean | false | support upload whole directory |
| data | object/function(file) | other data object to post or a function which returns a data object(a promise object which resolve a data object) | |
| headers | object | {} | http headers to post, available in modern browsers |
| accept | string | input accept attribute | |
| capture | string | input capture attribute | |
| multiple | boolean | false | only support ie10+ |
| onStart | function | start upload file | |
| onError | function | error callback | |
| onSuccess | function | success callback | |
| onProgress | function | progress callback, only for modern browsers | |
| beforeUpload | function | null | before upload check, return false or a rejected Promise will stop upload, only for modern browsers |
| customRequest | function | null | provide an override for the default xhr behavior for additional customization |
| withCredentials | boolean | false | ajax upload with cookie send |
| openFileDialogOnClick | boolean | true | useful for drag only upload as it does not trigger on enter key or click event |
| pastable | boolean | false | support paste upload |
err: request error messageresponse: request response, not support on iframeUploadfile: upload fileresult: response bodyfile: upload filexhr: xhr header, only for modern browsers which support AJAX upload. since 2.4.0Allows for advanced customization by overriding default behavior in AjaxUploader. Provide your own XMLHttpRequest calls to interface with custom backend processes or interact with AWS S3 service through the aws-sdk-js package.
customRequest callback is passed an object with:
onProgress: (event: { percent: number }): voidonError: (event: Error, body?: Object): voidonSuccess: (body: Object): voiddata: Objectfilename: Stringfile: FilewithCredentials: Booleanaction: Stringheaders: Objectabort(file?: File) => void: abort the uploading file
@rc-component/upload is released under the MIT license.
FAQs
upload ui component for react
The npm package @rc-component/upload receives a total of 515,941 weekly downloads. As such, @rc-component/upload popularity was classified as popular.
We found that @rc-component/upload demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
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.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.