Javascript Find File Extension From String

[Solved] Javascript Find File Extension From String | C - Code Explorer | yomemimo.com
Question : javascript get file extension

Answered by : code-grepper

var fileName = "myDocument.pdf";
var fileExtension = fileName.split('.').pop(); //"pdf"

Source : | Last Update : Fri, 09 Aug 19

Question : javascript find file extension from string

Answered by : yawning-yak-butdi844asxz

var ext = fileName.split('.').pop();

Source : https://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript | Last Update : Wed, 11 Mar 20

Question : how to get the extension from filename using javascript

Answered by : clear-crocodile-5t9988ie0a47

var ext = fileName.substr(fileName.lastIndexOf('.') + 1);

Source : https://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript | Last Update : Mon, 20 Jul 20

Question : javascript get file extension from string

Answered by : fancy-ferret-en695bp866gi

// Use the lastIndexOf method to find the last period in the string, and get the part of the string after that:
var ext = fileName.substr(fileName.lastIndexOf('.') + 1);

Source : https://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript | Last Update : Fri, 23 Oct 20

Question : JavaScript - How to get the extension of a filename

Answered by : gorgeous-gannet-dmk7nm6ryyn2

let filename = "index.js";
let extension = filename.split(".").pop();
console.log(extension); // "js"

Source : https://sebhastian.com/javascript-filename-extension/ | Last Update : Tue, 14 Jun 22

Question : get file extention js

Answered by : elegant-eland-l1jg7e3e4p33

function getFileNameWithExt(event) { if (!event || !event.target || !event.target.files || event.target.files.length === 0) { return; } const name = event.target.files[0].name; const lastDot = name.lastIndexOf('.'); const fileName = name.substring(0, lastDot); const ext = name.substring(lastDot + 1); outputfile.value = fileName; extension.value = ext;
}

Source : https://stackoverflow.com/questions/43708127/javascript-get-the-filename-and-extension-from-input-type-file | Last Update : Tue, 07 Sep 21

Question : how to get file extension in javascript

Answered by : fancy-fly-z8fpi7xo11pk

var fileName = "myDocument.pdf";
var fileExtension = fileName.split('.').pop(); //"pdf"

Source : | Last Update : Wed, 06 Jan 21

Question : Get file extension in javascript

Answered by : dejan-ilic

file.originalname.match(/\..*$/)[0]

Source : https://regex101.com/ | Last Update : Sun, 25 Sep 22

Answers related to javascript find file extension from string

Code Explorer Popular Question For C