I've been looking everywhere for some help on making a component to help manage uploading files from within React to an endpoint I have setup.
I've tried numerous options, including integrating filedropjs. I decided against it because I don't have control over the elements it sets up in the DOM with the new FileDrop('zone', options);
This is what I have so far:
module.exports =  React.createClass({
displayName: "Upload",
handleChange: function(e){
    formData = this.refs.uploadForm.getDOMNode();
    jQuery.ajax({
        url: 'http://example.com',
        type : 'POST',
        xhr: function(){
            var myXhr = $.ajaxSettings.xhr();
            if(myXhr.upload){
                myXhr.upload.addEventListener('progress',progressHandlingFunction, false);
            }
            return myXhr;
        },
        data: formData,
        cache: false,
        contentType: false,
        processData: false,
        success: function(data){
            alert(data);
        }
    });
},
render: function(){
        return (
            <form ref="uploadForm" className="uploader" encType="multipart/form-data" onChange={this.handleChange}>
                <input ref="file" type="file" name="file" className="upload-file"/>
            </form>
        );
   }
 });
},
render: function(){
    console.log(this.props.content);
    if(this.props.content != ""){
        return (
            <img src={this.props.content} />
        );
    } else {
        return (
            <form className="uploader" encType="multipart/form-data" onChange={this.handleChange}>
                <input ref="file" type="file" name="file" className="upload-file"/>
            </form>
        );
    }
}
});
If someone could just point me in the right direction I would send some virtual hugs. I've been working on this quite extensively. I feel like I'm close, but not quite there.
Thanks!
 
     
     
     
     
     
    