Handling permission for file downloads