Could you please verify the file which you are trying to fetch, is associated with the userName or not? If yes, then at the time of fetching that file, either you have to pass the sessionId of that user or you can fetch it through the admin key. Why is it so, please go through this tutorial. It will help you in detail.
Also, at the time of uploading the file, you have to define that who will have the access to fetch that file. To provide the access, please have a look at this code snippet and let me known if you need any other help from our side.