Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-upload

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4-beta1

14

lib/AjaxUploader.js

@@ -5,2 +5,6 @@ 'use strict';

function uid() {
return Math.random().toString().slice(2);
}
var AjaxUploader = React.createClass({

@@ -35,3 +39,5 @@ displayName: 'AjaxUploader',

file.uid = uid();
var props = this.props;
props.onStart(file);
var req = request.post(props.action).attach(props.name, file, file.name);

@@ -43,6 +49,10 @@

req.on('progress', props.onProgress);
var progress = function progress(e) {
props.onProgress(e, file);
};
req.on('progress', progress);
req.end(function (err, ret) {
req.off('progress', props.onProgress);
req.off('progress', progress);
if (err || ret.status !== 200) {

@@ -49,0 +59,0 @@ var message = err ? err.message : ret.text;

@@ -81,2 +81,3 @@ 'use strict';

this.file = e.target.files[0];
this.props.onStart(this.file);
React.findDOMNode(this.refs.form).submit();

@@ -83,0 +84,0 @@ },

@@ -18,2 +18,3 @@ 'use strict';

onProgress: PropTypes.func,
onStart: PropTypes.func,
data: PropTypes.object,

@@ -29,2 +30,3 @@ accept: PropTypes.string

onProgress: empty,
onStart: empty,
onError: empty,

@@ -31,0 +33,0 @@ onSuccess: empty

2

package.json
{
"name": "rc-upload",
"version": "1.2.3",
"version": "1.2.4-beta1",
"description": "upload ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -54,2 +54,3 @@ # rc-upload

|accept | string | | input accept attribute |
|onStart | function| | start upload file |
|onError| function| | error callback |

@@ -56,0 +57,0 @@ | onSuccess | function | | success callback |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc