How to get the file name from a full path using JavaScript? September 21, 2022 by Tarik var filename = fullPath.replace(/^.*[\\\/]/, '') This will handle both \ OR / in paths