Same file cannot be uploaded in row
I am trying to upload same .CSV file in row. Second upload of the same file doesn't work. As per the log it says version 1.1.2 has fixed this issue. but looks like its still broken.
I'm unable to recreate on latest version, can you check your lock file and make sure you're running the latest?
@toufiqkhazi @travisdmathis I am also facing same issue while uploading same file second time in a row event doesn't get triggered
@vikrantch-hk can you please confirm version you have installed? I've tried recreating this on the live demo and cannot.... more information needed to troubleshoot.
@travisdmathis it's 1.1.4, below is code for button and event handler
<ReactFileReader handleFiles={handleUploadFiles} fileTypes={'.xlsx'}>
<button className="btn">Upload</button>
</ReactFileReader>
const handleUploadFiles = file => {
// tslint:disable-next-line:no-console
console.log(file);
// tslint:disable-next-line:no-console
// console.log(axios.defaults.headers.common['Authorization']);
const data = new FormData();
const imagedata = file[0];
// tslint:disable-next-line:no-console
console.log(imagedata);
data.append('file', file[0]);
data.append('fileName', file[0]);
// axios.get('api/vendor');
// tslint:disable-next-line:no-console
console.log('get success');
axios
.post('/api/upload', data)
.then(response => {
// tslint:disable-next-line:no-console
console.log(response);
toast.success(response.statusText);
this.setState({ vendorList: this.props.getEntities() });
this.setState({ file: null });
this.setState({ data: null });
file = null;
// return response;
})
.catch(error => {
// tslint:disable-next-line:no-console
console.log(error);
// alert(error);
toast.error(error.message);
// return error;
file = null;
});
// tslint:disable-next-line:no-console
console.log('bye');
// const workbook = XLSX.readFile(file);
// tslint:disable-next-line:no-console
console.log('workbook');
};
@vikrantch-hk do you get a console log when you select the file the second time? Is it that it just won't upload twice in a row?
console.log(file);
@travisdmathis no there are no logs if I upload same file twice in a row. First time it works properly or if I select any other file then also it works, only problem is selecting same file again
@vikrantch-hk https://github.com/vikrantch-hk I could not get this issue resolved so, I implemented a custom component using . onChnage I am calling a method which sets "event.target.value = null;" after all the processing is done. This resolves the issue of uploading the same file again and again
On Mon, Jun 18, 2018 at 6:36 AM vikrantch-hk [email protected] wrote:
@travisdmathis https://github.com/travisdmathis no there are no logs if I upload same file twice in a row. First time it works properly or if I select any other file then also it works, only problem is selecting same file again
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrillWork/react-file-reader/issues/20#issuecomment-398056219, or mute the thread https://github.com/notifications/unsubscribe-auth/AKVnLXs9SoDkTEte3bbQrrBnHUwFgzmQks5t96zagaJpZM4TwSUj .
@toufiqkhazi can you please share code snippet, I haven't worked much in js so it will be really helpful
@toufiqkhazi you never responded to my questions... Second, why wouldn't you submit a fix, instead of writing a whole new component.. smh...
The whole point of opensource is so when you find an issue you can also contribute.. not just slap an issue up, go away, then come back after not answering questions complaining no one helped you. Relying on just the maintainer to fix everything is a sure way for a project to die.
@vikrantch-hk i will submit a fix sometime this week for this issue.. i see whats happening. We are clearing the input, but not the event.target
@toufiqkhazi @travisdmathis thanks.
@travisdmathis https://github.com/travisdmathis I am really sorry. We were in the middle critical development very close to deadline so couldn't reply then. My apologies.
On Mon, Jun 18, 2018 at 10:31 AM Travis Mathis [email protected] wrote:
@toufiqkhazi https://github.com/toufiqkhazi you never responded to my questions...
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GrillWork/react-file-reader/issues/20#issuecomment-398133779, or mute the thread https://github.com/notifications/unsubscribe-auth/AKVnLdMk4olMhy8U_g3FYTzWYWOD9cWYks5t9-QMgaJpZM4TwSUj .
no worries @toufiqkhazi