react-s3-uploader
Advanced tools
Comparing version 1.1.16 to 1.1.17
{ | ||
"name": "react-s3-uploader", | ||
"version": "1.1.16", | ||
"version": "1.1.17", | ||
"description": "React component that renders a file input and automatically uploads to an S3 bucket", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -36,3 +36,3 @@ "use strict"; | ||
new S3Upload({ | ||
fileElement: this.getDOMNode(), | ||
fileElement: findDOMNode(this), | ||
signingUrl: this.props.signingUrl, | ||
@@ -49,2 +49,6 @@ onProgress: this.props.onProgress, | ||
clear: function() { | ||
clearInputFile(findDOMNode(this)); | ||
}, | ||
render: function() { | ||
@@ -56,3 +60,23 @@ return React.DOM.input(objectAssign({}, this.props, {type: 'file', onChange: this.uploadFile})); | ||
function findDOMNode(cmp) { | ||
return React.findDOMNode ? React.findDOMNode(cmp) : cmp.getDOMNode(); | ||
} | ||
// http://stackoverflow.com/a/24608023/194065 | ||
function clearInputFile(f){ | ||
if(f.value){ | ||
try{ | ||
f.value = ''; //for IE11, latest Chrome/Firefox/Opera... | ||
}catch(err){ } | ||
if(f.value){ //for IE5 ~ IE10 | ||
var form = document.createElement('form'), | ||
parentNode = f.parentNode, ref = f.nextSibling; | ||
form.appendChild(f); | ||
form.reset(); | ||
parentNode.insertBefore(f,ref); | ||
} | ||
} | ||
} | ||
module.exports = ReactS3Uploader; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15988
289