In: Computer Science
upload cvs file dialog
it's sub menu bar and when I click this I want to popup file dialog and select cvs file
<a href="#" id="loadCSV">Load CSV file</a>
For this you have to use javascript+ jQuery
HTML code for this is
<HTML>
<title>Uploading CSV file</title>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<style>
#loadCSV{
text-decoration:none;
}
#CSVupload{
display:none
}
</style>
</head>
<input id="CSVupload" type="file" accept=".csv"/>
<a href="" id="loadCSV">Load CSV file</a>
<script>
$(function(){
$("#loadCSV").on('click', function(e){
e.preventDefault();
$("#CSVupload:hidden").trigger('click');
});
});
</scripts>
If any queries comment please
if any one getting problems with jQuery then use simple code without hyper link
<label>
<input type="file" id="file" accept=".csv" style="display:
none;">
Load CSV File
</label>
check it out
Thank you:)