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 check the extension of a file in javascript

return filename.split('.').pop();
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 move li to first position 
Javascript :: get children jquery index 
Javascript :: how to hide javascript code 
Javascript :: js string to node 
Javascript :: how to pass sequelize transaction to association helper method 
Javascript :: js random in range 
Javascript :: btoa javascript 
Javascript :: react import css only for component 
Javascript :: TypeError: client.guilds.forEach is not a function 
Javascript :: vue 3 computed getter setter 
Javascript :: send message whatsapp javascript 
Javascript :: javascript orderby 
Javascript :: javascript how to check if element is visible on screen 
Javascript :: js get random word from list 
Javascript :: event.target data-target 
Javascript :: select all elements javascript 
Javascript :: add array of object to state react 
Javascript :: on function change body background image 
Javascript :: jquery count selected options 
Javascript :: fill an array of zeroes in js 
Javascript :: javascript text word wrap replace 
Javascript :: iframe chrome console 
Javascript :: reading files with node.js 
Javascript :: how to use url parameters in react 
Javascript :: sort object by key value javascript 
Javascript :: get ascii value of char javascript 
Javascript :: owl.js cdn 
Javascript :: remove all symbols javascript 
Javascript :: generate guard angular 
Javascript :: react replace all line breaks with br 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =