Only add files to file list when uploading to current directory

Fix Issue #6683