finished writing code to upload to server. IS NOT DEBUGGED