Fix for an issue with uploading sub-folders

10x to @iham for testing and for the solution.