I am trying to figure out how to use the SPServices JS library to upload a file without using the HTML5 JavaScript file API. This is specifically targeting IE9. I have a solution that works with all browsers that have the file API.

I understand I have to Base 64 encode the file, etc. But I am not sure how I get the data without using the file API. Does anyone have any suggestions?

2 Answers 2


I could not find any good way to do it with IE8 or IE9, so I utilized the OOB AttachFile.aspx form: (I am using SPService to get query string & I am adding input control dynamically with JQuery)

function readyCall() {
    //Get Query String
    var queryString = $().SPServices.SPGetQueryString();

    //Tasks List ID (i.e. 0A347169-CE79-4B7F-B561-C23A7027F06B)
    var listID = queryString["List"];
    //Task ID (i.e. 14)
    var itemId = queryString["ID"];

    //Replace the Loading label which is originally added in infopath (I am adding upload control dynamically)
    var attachmentDiv = $("div").filter(function () {
        return $(this).text() == 'Loading...';
    attachmentDiv.html('<input type="Button" onclick="OpenDialog(\'/_layouts/AttachFile.aspx?ListId={'+listID+'}&ItemId='+itemId+ '\',600,150)" value="Upload"/>');

function OpenDialog(_url, _width, _hight)
    var options = {
    title: "Upload Attchment",
    width: _width,
    height: _hight,
    url: _url };

enter image description here

  • That is awesome. I am using this in a Single Page App, so I wanted to avoid a post. But I imagine I can do this in an iframe or something to make it work. I've used all my votes for the next 20 hrs or so, I'll add an upvote as soon as I am able. Feb 24, 2014 at 14:05

If uploading to a Document Library, then I have something I created a few months ago. It uses jQuery and SPServices, but the actual file uploading is handled by the native SharePoint Upload.aspx page. So it's compatible with non HTML5 browsers and non-IE browsers.

I use it with SP2007 today and IE8, IE9. It also works with SP2010.

Go here - SPWidgets - http://purtuga.github.io/SPWidgets/

You want to look at the Upload widget.

Hope this helps.

  • I'm looking for list item attachments. Will a similar strategy work? Jul 18, 2013 at 1:49
  • No, I dont think it will work. This was specifically designed for Document Libraries.
    – Paul T.
    Jul 18, 2013 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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