set upload dir dynamically from window.location.pathname