What I want to do is to have the file name specified by the input element as shown below, and when I press the button, I want to get the contents.
Assume that the csv file is loaded.
IE10 and later use FileAPI, but IE9 does not work.
I thought I could write it like below, but this code didn't work.
Sorry, I didn't write any restrictions.
I don't want to use MS-specific constraints such as ActiveX.
However, I think it's okay to use a major library such as JQuery that absorbs the difference.
<html>
<head>
<title>Sample</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">/script>
</head>
<body>
<script type="text/javascript">
function CSVTEST() {
value = document.getElementById("csvfile").value;
alert(em);
$.get(em, function(data){
alert(data);
});
};
</script>
<input id="csvfile" type="file">
<input type="submit" value="OK" onclick="CSVTEST()">
</body>
</html>
© 2024 OneMinuteCode. All rights reserved.