Eric im pulling the doc file from my own server and then storing the responseText into the variable serverDoc. when i look in firebug it looks like a binary .doc file. but when i put that variable into the header post to google it only shows up at 20 characters or soo. i think somehow my post gets cut off because there isnt even an END OF PART at the end
My Post: --END_OF_PART Content-Type: application/atom+xml <?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> --END_OF_PART Content-Type: application/msword �� ࡱ � On Jul 29, 12:27 am, "Eric (Google)" <api.e...@google.com> wrote: > Make sure the actual request being made looks like > one of these examples (depending on what you're > using):http://code.google.com/apis/documents/docs/2.0/developers_guide_proto... > > Also, I'm not sure how you are filling in the variable > serverDoc. How are you reading the binary .doc file? > > Eric > > On Jul 28, 2:32 am, cgrizz <cartergre...@gmail.com> wrote: > > > 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 -~----------~----~----~----~------~----~------~--~---