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

file extension name in js

const path = require('path')

path.extname('picture.png') //.png
path.extname('picture.of.a.dog.png') //.png
path.extname('picture.of.a.dog.jpg') //.jpg
path.extname('picture.of.a.dog.jpeg') //.jpeg
Comment

Get file extension in javascript

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

PREVIOUS NEXT
Code Example
Javascript :: read data from json using node 
Javascript :: how to format unix timestamp javascript 
Javascript :: word count js 
Javascript :: get select option selected text jquery 
Javascript :: leaflet change zoom button position 
Javascript :: get the current date time in javascript in 12 hour format 
Javascript :: how to check if a number is float javascript 
Javascript :: How to parse POST requests with express nodejs 
Javascript :: discord.js mention regex 
Javascript :: allow only letters in div javascript 
Javascript :: javascript with html 
Javascript :: javascript filesystem 
Javascript :: react function with form 
Javascript :: select element in js 
Javascript :: scrollto element by id center 
Javascript :: document getelementsbyclassname not getting all elements 
Javascript :: get everything between two characters regex 
Javascript :: js queryselector radio checked 
Javascript :: mm dd yyyy how to get date in this format in javascript 
Javascript :: #react native shadow 
Javascript :: AppBridgeError shopify 
Javascript :: adonisjs column default value 
Javascript :: exiting jshell 
Javascript :: Javascript case insensitive string comparison 
Javascript :: generate random alphanumeric string javascript 
Javascript :: react localstorage 
Javascript :: select only jpg jpeg images 
Javascript :: discord bot steaming satus 
Javascript :: js switch case 
Javascript :: click on child prevent click on parent 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =