Correcting JS: file names with '.' in it apart from file extension was not allowing .png files to be uploaded