Try calling flush() on your DataOutputStream, and even close the dos prior to attempting to creating the URL to the file