Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

uploadgetfiletypefileextension

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

PREVIOUS NEXT
Code Example
Javascript :: joi string custom validation fuction 
Javascript :: android force date inside RecyclerView to re render 
Javascript :: discord.js find role by name 
Javascript :: add key vakue to front of object 
Javascript :: javascript date methods 
Javascript :: javascript backslash 
Javascript :: react to string 
Javascript :: To split a full name into first and last names in JavaScript 
Javascript :: loop in react depending on number 
Javascript :: javascript cookie expire in 5 minutes 
Javascript :: jQuery on right mouse click 
Javascript :: local storage 
Javascript :: radio button onclick jquery 
Javascript :: send mail with javascript 
Javascript :: js promisify in browser 
Javascript :: convert date to string format dd/mm/yyyy javascript 
Javascript :: jquery get selected dropdown item 
Javascript :: getting data from form node 
Javascript :: subtract dates javascript 
Javascript :: get if user signed in firebase 
Javascript :: is material ui not working with react 18 
Javascript :: javascript check if variable is number 
Javascript :: js copy span text to clipboard 
Javascript :: javascript remove object property 
Javascript :: jest expect error type 
Javascript :: function(a, b){return b - a} 
Javascript :: js getelementbyid 
Javascript :: nodejs mysql insert object query 
Javascript :: package.json set environment variables 
Javascript :: momentTimeZone 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =