title: How to perform a two callback functionality?
body: <p>I am using the cloudinary api with REACT/AXIOS and was wondering how I could pull data before the axios call and also after. My problem I am having is that if I use one callback I can only put the one or the other data. So is it possible to use two callbacks and if so how would you do so? </p>
  
  <p>Or should I go about this a different way?</p>
  
  <p>What I want is to pull the progression of the upload out and be able to store that value to the state. My only problem is that I am not sure of the correct way to do this? I need to do it inside the <code>onUploadProgress</code> fucntion.</p>
  
  <p>Here is the code:</p>
  
  <p><strong>Function in component:</strong></p>
  
  <pre><code>uploadImage(files) {
      const image = files[0];
  
      const cloudName = 'hyszj0vmt';
      const url = `https://api.cloudinary.com/v1_1/${cloudName}/image/upload`;
  
      const apiSecret = '***********';
      const uploadPreset = '**************';
      const timestamp = Date.now() / 1000;
      const paramStr = `timestamp=${timestamp}&amp;upload_preset=${uploadPreset}${apiSecret}`;
      const signature = sha1(paramStr);
      const params = {
        api_key: '*******',
        timestamp: timestamp,
        upload_preset: uploadPreset,
        signature: signature
      };
  
      APIManager.upload(url, image, params, (err, response) =&gt; {
        if (err) {
          console.log(`UPLOAD ERROR: ${err}`);
          return;
        }
  
        const imageUrl = response['secure_url'];
        let updatedProfile = Object.assign({}, this.state.updated);
        updatedProfile['image'] = imageUrl;
  
        this.setState({
          updated: updatedProfile
        });
      });
    }
  </code></pre>
  
  <p><strong>APIManager function:</strong></p>
  
  <pre><code>upload: (endpoint, file, params, callback) =&gt; {
      let fd = new FormData();
  
      fd.append('file', file);
      Object.keys(params).forEach(key =&gt; {
        fd.append(key, params[key]);
      });
  
      const config = {
        headers: { 'X-Requested-With': 'XMLHttpRequest' },
        onUploadProgress: progressEvent =&gt; {
          const progress = Math.round(
            progressEvent.loaded * 100.0 / progressEvent.total
          );
  
          console.log(progress + '%');
        }
      };
  
      axios
        .post(endpoint, fd, config)
        .then(response =&gt; {
          const { data } = response;
          callback(null, data);
        })
        .catch(err =&gt; {
          callback(err, null);
        });
    }
  };
  </code></pre>