1- # rc-upload
1+ # @ rc-component/ upload
22
33React Upload
44
5- [ ![ NPM version] [ npm-image ]] [ npm-url ]
6- [ ![ npm download] [ download-image ]] [ download-url ]
7- [ ![ build status] [ github-actions-image ]] [ github-actions-url ]
8- [ ![ Codecov] [ codecov-image ]] [ codecov-url ]
9- [ ![ bundle size] [ bundlephobia-image ]] [ bundlephobia-url ]
10- [ ![ dumi] [ dumi-image ]] [ dumi-url ]
5+ [ ![ NPM version] [ npm-image ]] [ npm-url ] [ ![ npm download] [ download-image ]] [ download-url ] [ ![ build status] [ github-actions-image ]] [ github-actions-url ] [ ![ Codecov] [ codecov-image ]] [ codecov-url ] [ ![ bundle size] [ bundlephobia-image ]] [ bundlephobia-url ] [ ![ dumi] [ dumi-image ]] [ dumi-url ]
116
12- [ npm-image ] : http://img.shields.io/npm/v/rc-upload.svg?style=flat-square
13- [ npm-url ] : http://npmjs.org/package/rc-upload
7+ [ npm-image ] : http://img.shields.io/npm/v/@ rc-component/ upload.svg?style=flat-square
8+ [ npm-url ] : http://npmjs.org/package/@ rc-component/ upload
149[ travis-image ] : https://img.shields.io/travis/react-component/upload/master?style=flat-square
1510[ travis-url ] : https://travis-ci.com/react-component/upload
1611[ github-actions-image ] : https://github.com/react-component/upload/workflows/CI/badge.svg
@@ -21,10 +16,10 @@ React Upload
2116[ david-image ] : https://david-dm.org/react-component/upload/status.svg?style=flat-square
2217[ david-dev-url ] : https://david-dm.org/react-component/upload?type=dev
2318[ david-dev-image ] : https://david-dm.org/react-component/upload/dev-status.svg?style=flat-square
24- [ download-image ] : https://img.shields.io/npm/dm/rc-upload.svg?style=flat-square
25- [ download-url ] : https://npmjs.org/package/rc-upload
26- [ bundlephobia-url ] : https://bundlephobia.com/package/rc-upload
27- [ bundlephobia-image ] : https://badgen.net/bundlephobia/minzip/rc-upload
19+ [ download-image ] : https://img.shields.io/npm/dm/@ rc-component/ upload.svg?style=flat-square
20+ [ download-url ] : https://npmjs.org/package/@ rc-component/ upload
21+ [ bundlephobia-url ] : https://bundlephobia.com/package/@ rc-component/ upload
22+ [ bundlephobia-image ] : https://badgen.net/bundlephobia/minzip/@ rc-component/ upload
2823[ dumi-url ] : https://github.com/umijs/dumi
2924[ dumi-image ] : https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
3025
@@ -43,16 +38,16 @@ online example: https://upload.react-component.vercel.app/
4338
4439## Feature
4540
46- * support IE11+, Chrome, Firefox, Safari
41+ - support IE11+, Chrome, Firefox, Safari
4742
4843## install
4944
50- [ ![ rc-upload] ( https://nodei.co/npm/rc-upload.png )] ( https://npmjs.org/package/rc-upload )
45+ [ ![ @ rc-component/ upload ] ( https://nodei.co/npm/@ rc-component/ upload.png )] ( https://npmjs.org/package/@ rc-component/ upload )
5146
5247## Usage
5348
5449``` js
55- var Upload = require (' rc-upload' );
50+ var Upload = require (' @ rc-component/ upload' );
5651var React = require (' react' );
5752React .render (< Upload / > , container);
5853```
@@ -61,30 +56,30 @@ React.render(<Upload />, container);
6156
6257### props
6358
64- | name| type| default| description|
65- | ----- | ---| -------- | ---- |
66- | name | string | file| file param post to server |
67- | style | object | {}| root component inline style |
68- | className | string | - | root component className |
69- | disabled | boolean | false | whether disabled |
70- | component | "div"| "span" | "span"| wrap component name |
71- | action| string | ; function(file): string | ; Promise< ; string> ; | | form action url |
72- | method | string | post | request method |
73- | directory| boolean | false | support upload whole directory |
74- | 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) |
75- | headers| object | {} | http headers to post, available in modern browsers |
76- | accept | string | | input accept attribute |
77- | capture | string | | input capture attribute |
78- | multiple | boolean | false | only support ie10+|
79- | onStart | function| | start upload file |
80- | onError| function| | error callback |
81- | onSuccess | function | | success callback |
82- | onProgress | function || progress callback, only for modern browsers|
83- | beforeUpload| function | null| before upload check, return false or a rejected Promise will stop upload, only for modern browsers|
84- | customRequest | function | null | provide an override for the default xhr behavior for additional customization|
85- | withCredentials | boolean | false | ajax upload with cookie send |
86- | openFileDialogOnClick | boolean | true | useful for drag only upload as it does not trigger on enter key or click event |
87- | pastable | boolean | false | support paste upload |
59+ | name | type | default | description |
60+ | --- | --- | --- | --- |
61+ | name | string | file | file param post to server |
62+ | style | object | {} | root component inline style |
63+ | className | string | - | root component className |
64+ | disabled | boolean | false | whether disabled |
65+ | component | "div" \| "span" | "span" | wrap component name |
66+ | action | string | ; function(file): string | ; Promise< ; string> ; | | form action url |
67+ | method | string | post | request method |
68+ | directory | boolean | false | support upload whole directory |
69+ | 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) |
70+ | headers | object | {} | http headers to post, available in modern browsers |
71+ | accept | string | | input accept attribute |
72+ | capture | string | | input capture attribute |
73+ | multiple | boolean | false | only support ie10+ |
74+ | onStart | function | | start upload file |
75+ | onError | function | | error callback |
76+ | onSuccess | function | | success callback |
77+ | onProgress | function | | progress callback, only for modern browsers |
78+ | beforeUpload | function | null | before upload check, return false or a rejected Promise will stop upload, only for modern browsers |
79+ | customRequest | function | null | provide an override for the default xhr behavior for additional customization |
80+ | withCredentials | boolean | false | ajax upload with cookie send |
81+ | openFileDialogOnClick | boolean | true | useful for drag only upload as it does not trigger on enter key or click event |
82+ | pastable | boolean | false | support paste upload |
8883
8984#### onError arguments
9085
@@ -96,31 +91,28 @@ React.render(<Upload />, container);
9691
97921 . ` result ` : response body
98932 . ` file ` : upload file
99- 3 . ` xhr ` : xhr header, only for modern browsers which support AJAX upload. since
100- 2.4.0
101-
94+ 3 . ` xhr ` : xhr header, only for modern browsers which support AJAX upload. since 2.4.0
10295
10396### customRequest
10497
10598Allows 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.
10699
107100customRequest callback is passed an object with:
108101
109- * ` onProgress: (event: { percent: number }): void `
110- * ` onError: (event: Error, body?: Object): void `
111- * ` onSuccess: (body: Object): void `
112- * ` data: Object `
113- * ` filename: String `
114- * ` file: File `
115- * ` withCredentials: Boolean `
116- * ` action: String `
117- * ` headers: Object `
118-
102+ - ` onProgress: (event: { percent: number }): void `
103+ - ` onError: (event: Error, body?: Object): void `
104+ - ` onSuccess: (body: Object): void `
105+ - ` data: Object `
106+ - ` filename: String `
107+ - ` file: File `
108+ - ` withCredentials: Boolean `
109+ - ` action: String `
110+ - ` headers: Object `
119111
120112### methods
121113
122114abort(file?: File) => void: abort the uploading file
123115
124116## License
125117
126- rc-upload is released under the MIT license.
118+ @ rc-component/ upload is released under the MIT license.
0 commit comments