How to custom save/attach file to a list through jquery?

Aug 19, 2011 at 9:02 AM


I am using custom save button for a list 'MyList'. i am able to save all the fields. i am using these code:

function save(){

    operation: "UpdateListItems",
    async: false,
        webURL: "Valid URL",
        listName: "MyCity",
        updates: "<Batch OnError='Continue'>" +
        "<Method ID='1' Cmd='New'>" +                                     
                                        "<Field Name='Country'>" + $("#Countrydd").val() + "</Field>" +
                                        "<Field Name='State'>" + $("#Statedd").val() + "</Field>" +
                                        "<Field Name='City'>" + $("#Citydd").val() + "</Field>" +
                                    "</Method>" +
                 completefunc: function (xData, Status) {


But the problem is, i am not able to save the the 'Attach File' since i have not written the code for that. Please some1 guide me with the file attachment save code.
Thanks in advance.