how to increment the filename if file already exists in javascript