function: take picture and upload it to server