4.5.2 • Published 3 months ago

rc-upload v4.5.2

Weekly downloads
552,200
License
MIT
Repository
github
Last release
3 months ago

rc-upload


React Upload

NPM version build status Test coverage npm download

Development

npm install
npm start

Example

http://localhost:8020/examples/

online example: http://react-component.github.io/upload/examples/simple.html

Feature

  • support IE11+, Chrome, Firefox, Safari

install

rc-upload

Usage

var Upload = require('rc-upload');
var React = require('react');
React.render(<Upload />, container);

API

props

nametypedefaultdescription
namestringfilefile param post to server
styleobject{}root component inline style
classNamestring-root component className
disabledbooleanfalsewhether disabled
component"div""span""span"wrap component name
onReadyfunctiononly call when supportServerRender is true, upload is rendered completely
actionstring | function(file): string | Promise<string>form action url
methodstringpostrequest method
directorybooleanfalsesupport upload whole directory
dataobject/function(file)other data object to post or a function which returns a data object
headersobject{}http headers to post, available in modern browsers
acceptstringinput accept attribute
multiplebooleanfalseonly support ie10+
onStartfunctionstart upload file
onErrorfunctionerror callback
onSuccessfunctionsuccess callback
onProgressfunctionprogress callback, only for modern browsers
beforeUploadfunctionnullbefore upload check, return false or a rejected Promise will stop upload, only for modern browsers
customRequestfunctionnullprovide an override for the default xhr behavior for additional customization
withCredentialsbooleanfalseajax upload with cookie send
openFileDialogOnClickbooleantrueuseful for drag only upload as it does not trigger on enter key or click event
transformFilefunction(file): Promise<blob>transform file before request

onError arguments

  1. err: request error message
  2. response: request response, not support on iframeUpload
  3. file: upload file

onSuccess arguments

  1. result: response body
  2. file: upload file
  3. xhr: xhr header, only for modern browsers which support AJAX upload. since 2.4.0

customRequest

Allows 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 }): void
  • onError: (event: Error, body?: Object): void
  • onSuccess: (body: Object): void
  • data: Object
  • filename: String
  • file: File
  • withCredentials: Boolean
  • action: String
  • headers: Object

methods

abort(file?: File) => void: abort the uploading file

License

rc-upload is released under the MIT license.

4.3.6

3 months ago

4.5.2

3 months ago

4.5.1

4 months ago

4.4.0

5 months ago

4.3.5

6 months ago

4.3.4

2 years ago

4.3.3

2 years ago

4.3.2

2 years ago

4.3.1

3 years ago

4.3.0

3 years ago

4.2.1

3 years ago

4.2.0

3 years ago

4.2.0-alpha.0

3 years ago

4.1.0

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-alpha.6

3 years ago

4.0.0-alpha.5

3 years ago

4.0.0-alpha.3

3 years ago

4.0.0-alpha.4

3 years ago

4.0.0-alpha.1

3 years ago

4.0.0-alpha.2

3 years ago

4.0.0-alpha.0

3 years ago

3.3.4

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.3.1

4 years ago

3.3.0

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.4

4 years ago

3.1.3

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.4

4 years ago

3.0.3

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

3.0.0-alpha.2

4 years ago

3.0.0-alpha.1

4 years ago

3.0.0-alpha.0

4 years ago

2.9.4

4 years ago

2.9.3

4 years ago

2.9.2

4 years ago

2.9.1

4 years ago

2.9.0

4 years ago

2.8.1

4 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.8

5 years ago

2.6.7

5 years ago

2.6.6

5 years ago

2.6.5

5 years ago

2.6.4

5 years ago

2.6.3

5 years ago

2.6.2

5 years ago

2.6.1

5 years ago

2.6.0

6 years ago

2.5.1

6 years ago

2.5.0

6 years ago

2.4.4

6 years ago

2.4.3

7 years ago

2.4.2

7 years ago

2.4.1

7 years ago

2.4.0

7 years ago

2.3.8

7 years ago

2.3.7

7 years ago

2.3.5

7 years ago

2.3.4

7 years ago

2.3.3

7 years ago

2.3.2

7 years ago

2.3.1

7 years ago

2.3.0

7 years ago

2.2.0

7 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.4

8 years ago

2.0.3

8 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.14.0

8 years ago

1.13.3

8 years ago

1.13.2

8 years ago

1.13.1

8 years ago

1.13.0

8 years ago

1.12.0

8 years ago

1.11.0

8 years ago

1.10.0

8 years ago

1.9.0

8 years ago

1.8.1

8 years ago

1.8.0

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.7-beta

8 years ago

1.6.6

9 years ago

1.6.6-beta.1

9 years ago

1.6.5

9 years ago

1.6.4

9 years ago

1.6.3

9 years ago

1.5.9

9 years ago

1.5.8

9 years ago

1.5.7

9 years ago

1.6.2

9 years ago

1.6.1

9 years ago

1.6.0

9 years ago

1.5.6

9 years ago

1.5.5

9 years ago

1.5.4

9 years ago

1.5.3

9 years ago

1.5.2

9 years ago

1.5.1

9 years ago

1.4.4

9 years ago

1.4.3

9 years ago

1.4.2

9 years ago

1.4.1

9 years ago

1.4.0

9 years ago

1.3.7

9 years ago

1.3.6

9 years ago

1.3.5

9 years ago

1.3.4

9 years ago

1.3.3

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.4-beta2

9 years ago

1.2.4-beta1

9 years ago

1.2.3

9 years ago

1.2.2

9 years ago

1.2.1

9 years ago

1.2.0

9 years ago

1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.0

9 years ago