Added ability to restart an uploading when it is interrupted.
Refactored the code of the fronted.