+ 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) 

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.");


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

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: