For one of our customer, we are required to use HTML File Input control, to upload the file to another server using REST Web Services. I was able to achieve this using HTML FileReader.readAsArrayBuffer Method. But since users are using IE8 and IE9, HTML5 APIs are not supported. I tried using below code, but this reads only TXT file not other file types like DOCX or PNG
reader = new ActiveXObject("Scripting.FileSystemObject");
var file = reader.OpenTextFile(filePath, 1); //ActiveX File Object
output = file.ReadAll(); //text contents of file
file.Close(); //close file "input stream"
I use file inputs in a weird working way in IE8, maybe it can help you:
It sends the file chosen via fileInput as a POST request to the server, without reading its binary content. Do you absolutely need to read the file client-side ?
If you need cross-site upload, I think there are some iframe hacks for IE working.