Alright Eric
that info you gave me helped me out a lot i understood it and i'm
actually working with uploading word documents.  i was able to upload
a .txt file just fine.
my issue is now dealing with .doc files.  when i try to upload a .doc
file i get a 400 Bad Request: Multipart must have Atom and media
part.  i tried to google this error but all i got was more youtube api
issues.  can you help me out again?  this is my code:

GoogleDoc.upload1 = function(){

        //---------------------------get from the server------------------//
        var url = "HCI_usability_methods.doc";
        var request = new XMLHttpRequest();
        var serverDoc='';
        var uploadedDoc='';
        request.open('GET', url, true);

        request.onreadystatechange = function () {
                if (this.readyState == 4 && this.status == 200){
                  serverDoc=request.responseText;//Request Done


                        //--------------------------post to google
docs-------------------//

                        var data = '--END_OF_PART\r\n'+
                        'Content-Type: application/atom+xml\r\n\r
\n'+
                        "<?xml version='1.0' encoding='UTF-8'?>"+
                        '<atom:entry xmlns:atom="http://www.w3.org/2005/Atom";>'+
                        '<atom:category 
scheme="http://schemas.google.com/g/2005#kind";'+
                        ' term="http://schemas.google.com/docs/2007#document";
label="document"/>'+
                        '<atom:title>HCI Methods</atom:title>'+
                        '</atom:entry>\r\n'+
                        '--END_OF_PART\r\n'+
                        'Content-Type: application/msword\r\n\r\n'+
                        serverDoc+'\r\n'+
                        '--END_OF_PART--\r\n';



                        var Gurl = 
"/proxy/docs.google.com/feeds/documents/private/full";
                        var http = new XMLHttpRequest();
                        http.open('POST', Gurl, true);

                        http.setRequestHeader("Content-Type", 
'multipart/related;
boundary=END_OF_PART');
                        http.setRequestHeader("Content-Length", data.length);
                        http.setRequestHeader("Authorization", "GoogleLogin
auth="+authToken);
                        http.setRequestHeader("Slug", "HCI Methods");



                        http.onreadystatechange = function () {
                                if (this.readyState == 4 && this.status == 201){
                                  uploadedDoc=http.responseText;//Request Done
                                }
                        };
                        http.send(data);


                }
        };
        request.send(null);

}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Docs Data APIs" group.
To post to this group, send email to Google-Docs-Data-APIs@googlegroups.com
To unsubscribe from this group, send email to 
google-docs-data-apis+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Docs-Data-APIs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to