How do I get the contents of a file form a HTML form? Here is an example of what I'm working with. All it does it output something like C:Fake Pathnameoffile
<html>
<head>
<script type=text/javascript>
function doSomething(){
var fileContents = document.getElementById('idexample').value;
document.getElementById('outputDiv').innerHTML = fileContents;
}
</script>
</head>
<body >
<form name = form_input enctype=multipart/form-data>
<input type=file name=whocares id=idexample />
<button type=button onclick=doSomething()>Enter</button>
</form>
<div id=outputDiv></div>
</body>
</html>
EDIT:
It seems the solution is difficult to implement this way. What I'm trying to accomplish is sending a file to a python script on my webserver. This is my first time trying this sort of thing so suggestions are welcome. I supposes I could put the python script in my cgi folder and pass the values to it using something like...
/cgi/pythonscript.py?FILE_OBJECT=fileobjecthere&OTHER_VARIABLES=whatever
Would this be a better solution for sending file content to a webserver rather than having javacript open it directly using FileReader?