Skip to content
This repository has been archived by the owner on Oct 8, 2018. It is now read-only.

Commit

Permalink
Merge pull request #6 from GrillWork/revert-5-feature/add-output-to-h…
Browse files Browse the repository at this point in the history
…andlefiles

Revert "adds the ability to return both base64 strings and an HTML5 FileList"
  • Loading branch information
travisdmathis authored Apr 21, 2017
2 parents f8efd2e + 8ec8a8e commit 074da5e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 20 deletions.
15 changes: 0 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ npm install react-file-reader --save
```

## ChangeLog
- 1.0.4
- adds the ability to return both base64 strings and an HTML5 FileList from handleFiles
- 1.0.3
- bumps React version to 15.5 and fixes UNMET peer dependency with webpack
- 1.0.2
Expand Down Expand Up @@ -87,18 +85,5 @@ handleFiles = files => {
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA..."
```

### Both Base64 and HTML5 FileList
```javascript
handleFiles = (base64Files, fileList) => {
console.log(base64Files);
console.log(fileList);
}

<ReactFileReader base64={true} multipleFiles={true} handleFiles={this.handleFiles}>
<button className='btn'>Upload</button>
</ReactFileReader>
```
When `base64={true}`, `handleFiles` will return both the Base64 string and the HTML5 FileList object.

## Copyright
Copyright (c)2017 [Grillwork Inc](http://grillwork.io). See [LICENSE](https://github.com/GrillWork/react-file-reader/blob/master/LICENSE) for details.
4 changes: 2 additions & 2 deletions ReactFileReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class ReactFileReader extends React.Component {
files.push(reader.result)

if (files.length === ef.length) {
this.props.handleFiles(files, ef);
this.props.handleFiles(files);
}
}

Expand All @@ -46,7 +46,7 @@ export default class ReactFileReader extends React.Component {
let reader = new FileReader();

reader.onloadend = function (e) {
this.props.handleFiles(reader.result, ef)
this.props.handleFiles(reader.result)
}.bind(this)

reader.readAsDataURL(f)
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var ReactFileReader = function (_React$Component) {
files.push(reader.result);

if (files.length === ef.length) {
_this.props.handleFiles(files, ef);
_this.props.handleFiles(files);
}
};

Expand All @@ -85,7 +85,7 @@ var ReactFileReader = function (_React$Component) {
var _reader = new FileReader();

_reader.onloadend = function (e) {
this.props.handleFiles(_reader.result, ef);
this.props.handleFiles(_reader.result);
}.bind(_this);

_reader.readAsDataURL(f);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-file-reader",
"version": "1.1.0",
"version": "1.0.3",
"description": "A flexible ReactJS component for handling styled HTML file inputs.",
"main": "index.js",
"repository": "[email protected]:GrillWork/react-file-reader.git",
Expand Down

0 comments on commit 074da5e

Please sign in to comment.