Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript find file extension from string

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

how to get the extension from filename using javascript

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

JavaScript - How to get the extension of a filename

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

console.log(extension); // "js"
Comment

javascript get file extension from string

// 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);
Comment

get file extention js

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;
  
}
Comment

how to get file extension in javascript

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

Get file extension in javascript

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

PREVIOUS NEXT
Code Example
Javascript :: jquery detect when a checkbox is checked 
Javascript :: js start with 
Javascript :: regex javascript password 
Javascript :: beautify json python 
Javascript :: regex only uppercase letters js 
Javascript :: wait for element javascript 
Javascript :: $(...).autocomplete is not a function 
Javascript :: moment remove one day 
Javascript :: angular pipe first letter uppercase 
Javascript :: convert number to comma separated format javascript 
Javascript :: a tag do nothing on click 
Javascript :: npm remove dev dependencies from node_modules 
Javascript :: get height and width of screen in react native 
Javascript :: reactjs sass setup 
Javascript :: remove session storage 
Javascript :: nodejs command line arguments 
Javascript :: how to remove the last character of a string in javascript 
Javascript :: create element ns svg 
Javascript :: jquery if checkbox checked 
Javascript :: js create div 
Javascript :: reduce average javascript 
Javascript :: window.onload 
Javascript :: $(document).ready | document.ready 
Javascript :: install emailjs npm 
Javascript :: jquery onclick function 
Javascript :: regex between quotes 
Javascript :: json_decode jquery 
Javascript :: js pi 
Javascript :: title case javascript 
Javascript :: js proxy to array 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =