move upload outside of callback
fix: mkdir file update missing var