means set a timer and when it complete a given time slot it will auto logout user (stop all running process or terminate application) - so, you can use
in that case...
for situation of connection failure occurs while uploding files...
maintain a table in database
add whole list of file to upload in database and set their default value 0
as a file uploaded successfully update table record for that file and change it's state to 1 from 0
so, when a failure occur when you restart app check database and start upload of files which have state = 0 (means not uploaded)
so, it will like a Queue and you can also provide to cancel button to cancel uploading
Hope it helped you!