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 :: window.location.href jquery 
Javascript :: regex check if number is even 
Javascript :: js split array in half 
Javascript :: convert to objectid mongoose 
Javascript :: return current date in javascript 
Javascript :: jquery-3.2.1.min.js download 
Javascript :: js loop array backwards 
Javascript :: how to get the selected text of dropdown in jquery 
Javascript :: zip code regex 
Javascript :: google colab disconnect 
Javascript :: This is probably not a problem with npm. There is likely additional logging output above. 
Javascript :: javascript import jquery 
Javascript :: jquery enforce important 
Javascript :: counterup2.js cdn 
Javascript :: dconf-editor install terminal 
Javascript :: disable a button in javascript for a time period 
Javascript :: scroll jquery to anchor 
Javascript :: javascript celcius to farenheit 
Javascript :: get meta content jquery 
Javascript :: get current url host name in javascript 
Javascript :: js replace single quote with doubel quote 
Javascript :: express post body undefined 
Javascript :: javascript change css float property 
Javascript :: how to extract domain name of url of current page in javascript 
Javascript :: javascript get element width 
Javascript :: play sound javascript 
Javascript :: shorthand for document.ready 
Javascript :: javascript get css variable 
Javascript :: jquery loop through each child element 
Javascript :: javascript close window after print 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =