Only add files to file list when uploading to current directory

Fix Issue #6683
Merge pull request #7126 from nickvergessen/issue/6683

Only add files to file list when uploading to current directory