Uploading Form + File With React


#1

Hi Folks,

I am a bit new to this, but I am trying to create a simple web app which would allow users to file out form, and upload an image to it. I am managing to get the string part of the form saved to my collection, but not the image, any advice on how I can enable the images to also upload and then be able to call them when viewing individuals activities.

Here is my code:

export default class ActivityForms extends Component{

addActivity(event){
event.preventDefault();
var text = this.refs.activity.value.trim();
console.log(this);

Meteor.call('addActivity', text, ()=> {
  this.refs.activity.value = "";
});

}

render(){
return(








)
}
}

Meteor.methods({

addActivity(activity) {
	if(!Meteor.userId()) {
		throw new Meteor.Error('Error');
	}
	ActivityCollection.insert({
		text:activity,
                    complete: false,
		createdAt: new Date(),
		user: Meteor.userId(),
	});
}

});

Thank you!