function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chandra Prakash PandeyChandra Prakash Pandey 

File Uploading Error through Salesforce Javascript Remoting in IE9

I am trying to upload file attachment through javascript remoting. Code is working fine in Chrome/Mozilla/IE-10/IE-10+.
But code is not working in IE-9 Browser. I did little investigation and found IE9 doesn't support File Api.
In IE9 i get file undefined or null error.
My file upload code is:
function uploadFile() 
{
var file = document.getElementById('attachmentFile').files[0];
if(file != undefined)

if(file.size <= maxFileSize) 
{
attachmentName = file.name;
var fileReader = new FileReader();
fileReader.onloadend = function(e) {
var binary = "";
var bytes = new Uint8Array(e.target.result);
var length = bytes.byteLength; 
for (var i = 0; i < length; i++) 
{
binary += String.fromCharCode(bytes[i]);

attachment = (new sforce.Base64Binary(binary)).toString();  //Base 64 encode the file before sending it 
positionIndex = 0; 
fileSize = attachment.length; 
doneUploading = false; 
if(fileSize < maxStringSize) 
{
uploadAttachment(null);

else 
{
alert("Base 64 Encoded file is too large. Maximum size is " + maxStringSize + " your file is " + fileSize + ".");
}

fileReader.onerror = function(e) {
alert("There was an error reading the file. Please try again.");

fileReader.onabort = function(e) {
alert("There was an error reading the file. Please try again.");

fileReader.readAsArrayBuffer(file);

else 
{
alert("File must be under 4.3 MB in size. Your file is too large. Please try again.");
}

else 
{
alert("You must choose a file before trying to upload it");
}
}

I am heavily working on client side and i want to achieve this functionality by remote call.
any suggestions would be helpful.
Thanks in advance.
ShashankShashank (Salesforce Developers) 
I'm afraid we would definitely need File API to achieve this, as per this article: http://www.sundoginteractive.com/sunblog/posts/salesforce-mvp-brings-multi-file-uploading-to-salesforce

You can probably try drag and drop functionality and see if it works:
http://www.jitendrazaa.com/blog/salesforce/salesforce-drag-and-drop-file-uploader-component-with-progress-bar-html5-and-pure-javascript-based/
https://developer.salesforce.com/forums/ForumsMain?id=906F000000098TFIAY