title: file upload in react and node js not working
body: <p>i am trying very hard to upload file but no way i could find a clear solution .
  i have tried many ways but not working .  Now the console shows me 200 and give me message that file is uploaded but file is not going in the folder . i ahve checked file size limit and folder is ok but dont know why its not working. could any help please.</p>
  
  <p>///react component</p>
  
  <pre><code> import { saveBasicUser, getOneBasicUser, uploadFile } from 
   '../../actions/basicAction';
  
   this.state = { file: []};
  
   handleChange(event) {
  
   this.setState({
   [event.target.name]: event.target.value, 
   file: 
   event.target.files}) 
   }
  
   handleSubmit(event) {
   event.preventDefault();
     var file = this.state.file
  
      let formData = new FormData();
      formData.append('file', file);
  
      // console.log(obj);
      console.log(formData);
  
      //  this.props.dispatch(saveBasicUser(obj ))
       this.props.dispatch(uploadFile(formData ))
    }
  
  
  &lt;form onSubmit={this.handleSubmit} encType="multipart/form-data"&gt;  
  &lt;input type="file" name = "file" onChange={this.handleChange} /&gt;
  &lt;button type="submit" className="btn btn-success btn-lg"&gt;Submit&lt;/button&gt;
  </code></pre>
  
  <p>////////action part</p>
  
  <pre><code> export function uploadFile(formData) {
    console.log(formData)
    return (dispatch) =&gt; {
  
      return axios.post('/upload_file', {
        headers: { 'content-type': 'multipart/form-data' },
        data: formData
      }).then(function (res) {  
  
        console.log(res)
      }).catch(function (err) {
        console.log(" err")
        console.log(err)
      })
    }
  }
  </code></pre>
  
  <p>//////server part</p>
  
  <pre><code>var storage = multer.diskStorage({
    destination: function(req, file, callback) {
      callback(null, './uploads')
  },
    filename: function (req, file, cb) {
      cb(null, file.fieldname + '-' + Date.now()+ path.extname(file.originalname))
    }
  })
  
  
  var upload = multer({ storage: storage, limits: {fileSize : 1000000} }).single('file');
  
  
  app.post('/upload_file', function(req, res){
  
          upload(req, res, function(err) {
            if(err) {
                return res.end("Error uploading file.");
            }
            res.end("File is uploaded");
        });
  
    });
  </code></pre>