Move upload javascript to own file