upload dir fixed, refactoring