Monday, May 18, 2015

Accepting CSV File type Validation using JavaScript


Code:

<script language="javascript">
 function validate(form){
   var value = document.getElementById('fileUpload').value;
       ext = value.split(".").pop();
alert(ext);
   if (ext.toLowerCase() !== 'csv' ) {
       alert("Choose a .csv file only");
       return false;
   }

   return ( ext.toLowerCase() ==='csv' );
}

No comments:

Post a Comment