Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- onDrop(file) {
- const reader = new FileReader();
- reader.onload = () =>{
- const fileAsArrayBuffer = reader.result;
- this.props.uploadFile(fileAsArrayBuffer);
- };
- reader.readAsArrayBuffer(file[0]);
- }
- export const uploadFile = file => async dispatch => {
- const res = await axios.post('api/upload_file', file);
- dispatch({type: FETCH_OVERVIEW, payload: res.data.overview})
- };
Add Comment
Please, Sign In to add comment