Giter VIP home page Giter VIP logo

react-file-input's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-file-input's Issues

Clear selected value

Hi there!
How can I clear seleted value? I'm tried to set
value={this.state.image}
and then to set it to null, but it doesnt work.

Uncaught TypeError: React.createClass is not a function

app.js:37554 Uncaught TypeError: React.createClass is not a function
    at Object../node_modules/react-file-input/lib/index.js (app.js:37554)
    at __webpack_require__ (app.js:20)
    at Module../resources/js/components/PageAdd.js (app.js:53894)
    at __webpack_require__ (app.js:20)
    at Module../resources/js/pages/car/CarAdd.js (app.js:56941)
    at __webpack_require__ (app.js:20)
    at Module.<anonymous> (app.js:56019)
    at Module../resources/js/pages/App.js (app.js:56198)
    at __webpack_require__ (app.js:20)
    at Object../resources/js/app.js (app.js:52640)
./node_modules/react-file-input/lib/index.js @ app.js:37554
__webpack_require__ @ app.js:20
./resources/js/components/PageAdd.js @ app.js:53894
__webpack_require__ @ app.js:20
./resources/js/pages/car/CarAdd.js @ app.js:56941
__webpack_require__ @ app.js:20
(anonymous) @ app.js:56019
./resources/js/pages/App.js @ app.js:56198
__webpack_require__ @ app.js:20
./resources/js/app.js @ app.js:52640
__webpack_require__ @ app.js:20
0 @ app.js:59904
__webpack_require__ @ app.js:20
(anonymous) @ app.js:84
(anonymous) @ app.js:87

NPM Instructions are incorrect.

According to the Github and NPM docs, to use this library you should run:

npm install react-file-upload

but should instead say:

npm install react-file-input

Synthetic event properties null

Hello,

I tried using your plugin and found that the file received by the event handler was a Synthetic event with all its properties set to null. Is a fix in the works? I tried the demo and noticed the same thing happens. Thanks!

Difficult to understand how to trigger the file input click programatically

A common use case for a file input is to make it hidden and trigger a click on the input from another button. The way this is designed, it is difficult for me to understand how one could possibly do this. I tried giving the component a ref and then running "this.refs.fileImportInput.getDOMNode().click()" but I could not trigger it this way.

How to select the same file twice in a row?

First, thank you for making this, it's a very helpful tool.

I'm trying to handle the case where a user:

  • selects a file, say "abc.txt"
  • does some other things in the app
  • selects the same file, "abc.txt"

The second time the same file is selected, the onChange() handler does not fire. This does make sense, because the file technically has not changed.

But is there any way to "reset" the input, so that the same file will trigger some sort of event that I can handle?

I have setting a ref: <FileInput ref="myFile" ... /> followed by calling this.refs.myFile.state.value = ''; in the onChange function. This clears the string value in the input field, but it does not "reset" the component.

onChange not working ?

I'm able to click on the input and choose a file but then nothing happens, it seems onChange is never fired. Do you have any idea why ?

<FileInput
       name="file"
       accept=".jpg"
       placeholder="Your image"
       className="mdl-textfield__input"
       onChange={this.handleChange.bind(this)}
    />
    ....
    handleChange(event) {
    this.setState({
        'file': event.target.files[0]
    })
};

No visible Text

Hey,

Thanks for the package, I am stuck somewhere can you please help me?

I am trying the below piece of code for rendering the component, It is working perfectly fine, I am getting inputs in HTML but nothing is visible in the UI, no text or no button.

<FileInput
    name="avatarImage"
    accept=".jpg,.jpeg,.png,.gif"
    placeholder="Avatar Image"
    className="avatar-image"
    onChange={event => console.log('Selected file:', event.target.files[0])}
/>

The input targets the wrong element

Hi, i want to put an h2 above the input, but the file select only works if i click the h2, not the input itself. When i open the dev tools, it looks like that there are 2 input inside the code , and the one that responsible for selecting file, collides with the h2.

export class InputFile extends Component {

  handleChange(event) {
    console.log('Selected file:', event.target.files[0]);
  }

  render(){
    return(
      <div style={this.props.style}>
      {this.props.inputName ? <h2 className='input-desc'>{this.props.inputName}</h2> : null}
      <div className="selectFileContainer">
        <form>
          <FileInput
            name="selectFile"
            accept=".zip,.doc,.docs,.docx,.xls,.pdf,.xlsx,.jpg,.jpeg,.png"
            onChange={this.handleChange}
            >        
          </FileInput>
        </form>
        </div>        
      </div>
    )
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.