You create a browse button and let the user navigate the directory until he chooses a file. And the whole path and file name appear in the text element of the Browse button complex. So, how can I open that file to extract the data and act on it?
Here is how far I got with this:
<div id="browseFile" style="z-index: 1; left:-1040px; width:400px">
<input id="browse4File" name="/static/Import/Example Portfolio 1.csv" type="file" accept="text/plain" maxlength="200" style="left:20px; width: 200px;" /><br/>
<span style="position:relative;top:72px; left:320px; top:73px;">
<!--<button type="button" onclick="javascript:importFile()" style="font-size:16px;">Save</button>-->
<button type="button" onclick="javascript:u=document.getElementById('browse4File').value ;alert(u);" style="font-size:16px;">Save</button>
</span>
</div>
And the Alert() does show the file name, but it does not show the path. Security issue... no problem! But how can I open this file? Do I send it to the back end? I use Python on my server with cherrypy.
Or can JavaScript extract the contents of the file?
Please help...
TIA
DKean