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 :: npm jsonwebtoken 
Javascript :: html show password 
Javascript :: javascript add query string to url 
Javascript :: sort in array in javascript 
Javascript :: ordenar numeros array javascript 
Javascript :: javascript minute and second to convert seconds 
Javascript :: js get selected value by id 
Javascript :: angularjs make post request 
Javascript :: address 
Javascript :: add two float numbers in javascript 
Javascript :: konva line thickness 
Javascript :: javascript regex all matches match 
Javascript :: looping through json array 
Javascript :: setinterval react 
Javascript :: date object js 
Javascript :: react multiple classnames 
Javascript :: make a function and return the index of specific character in javascript 
Javascript :: remove last character of string in javascript 
Javascript :: js random number array 
Javascript :: bind in javascript 
Javascript :: groubbykey js 
Javascript :: javascript scrollby div 
Javascript :: mongoose limit skip 
Javascript :: what does useref do react 
Javascript :: how to change created_at format with javascript rails 
Javascript :: alpine js update data 
Javascript :: color picker in react js 
Javascript :: hot to set file views in nodejs 
Javascript :: typeracer 
Javascript :: express-session deprecated undefined resave option; provide resave option index.js:17:9 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =