support upload folder for fileserver
small tweak and fix a memory leak