I have some json data to upload to the server automatically.When the json data count is reached 500 it is automatically uploaded to the server.
I have to maintain the data in to two files, if data count is reached to 200,then it is moved to second file, then only i have convert the files into json and upload them to the server.
For example if 540 is the data count, then second file(upload file) contains first 500 data contents and rest 40 are stored in first file(entry file).
The remaining 40 files are uploaded to the server when user clicks the upload button i.e it is done manually otherwise it is uploaded to the server automatically when count reaches 500 (in the meanwhile if user does’nt clicks the upload button).
My issue is when 500 count is reached automatically uploading is done , if at the same time user clicks the upload button, its also triggers the upload event and tries to upload already uploaded(overwriting the) data.
Eg:
File{ [ data1, data 2 ]}.
when user clicks the upload button,the data is uploaded again which already existing in the server
Eg:
File{ [data1,data2,data3]}
how to handle this issue and is it possible to queue the upload button action?
You should clear the data once it is send to server.
So that you don’t have any repetitive copy of the old data.
Even user press the send data button you always has a fresh data to send to server.