Return JSON response from UploadImage when called from JavaScript