• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prevent multiple upload in browser

 
chennai Kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai All,

User upload a single .xls file from browser and we are reading the data using POI library and saving in to the database.
Here my scenario is we have to prevent the user for mutiple upload until one compete cycle is finish. When user tries to upload we show the message as
"Already one excel file is in processing,Please upload after job is finish".

I like to use synchronize method, but i have a doubt as how to trace one cycle is completed or not.

Here one cycle means that reads the data from the excel file and saving in to the database.

Thanks,
Ram kumar
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you are using Asynchronous i guess its AJAX only , so until the request has been recivied that is readystate is 4 and status is 200 keep the Mouse in Busy state (that is a dumble symbol) and after that keep mouse style in normal state .

 
chennai Kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

I am not using AJAX, simple javascript method it calls the action class.From the action class we are doing the business that reads the excel file and saves in to
the database. I created synchronized method in java to prevent, but here I have a doubt as how we know one complete cycle is finished or not.
Because When the user tries to upload another excel file from browser before the complete cycle we show the message to user as "Already one excel file is in
processing, Please upload after job is finish" in screen.

Please share best approch.

Thanks,
 
chennai Kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai All,

Please share your views.

Thanks
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use an in-memory lock against the session id.
Put a synchronized set in the application context, set the id in the set. In the upload code, remove the id in a try/finally block.
 
chennai Kumar
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,

Could you please share a example

Thanks and Regards,
Ram kumar
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My explanation was fairly detailed, is there a specific part you need help with?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic