refactor replace and autorename resolution in upload.php