0

This code for file uploading is working fine in chrome but not in IE 10 & 11. Any one has work around for this?

var file = $("#fileToUpload")[0].files[0];
var title = $("[id$='titleVal']").val();
var Comment = $("[id$='Comments']").val();
var status = $("[id$='Statustype']").val();      

client.createBlob('ContentVersion', {
        Origin: 'C', // 'H' for Chatter File, 'C' for Content Document
        PathOnClient: file.name,
        RecordTypeId: 'some valid id', 
        Document_Type__c: 'Brochure',
        Title: title, 
        StatusUpdated_Timestamp__c: new Date().toISOString(),
        FirstPublishLocationId: 'some valid id'            
    }, file.name, 'VersionData', file, function(response){
        console.log(response);
    }, function(request, status, response){            
        console.log(response);
});

IE console is showing below error

[{"message":"Missing Content-Type HTTP header","errorCode":"INVALID_CONTENT_TYPE"}] 
0

I added below line in forcetk.js before line number 296. Now IE is not troubling and its working fine in other browsers.

request.setRequestHeader('Content-Type', 'multipart/form-data; boundary=\"boundary_' + boundary + '\"');

I just compared request header in Chrome (for chrome it was working) and IE and found that above part was missing in IE request header. We will do some more testing and update the result. So far its uploading correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.