Resumable Upload for the Google Data APIs

23 views
Skip to first unread message

disorderdev

unread,
Apr 26, 2010, 12:07:24 PM4/26/10
to Google Data Javascript Client
this api needs to set HTTP request header, like this:

POST /feeds/upload/create-session/default/private/full?convert=false
HTTP/1.1
Host: docs.google.com
GData-Version: 3.0
Authorization: <your authorization header here>
Content-Length: 292
Content-Type: application/atom+xml
X-Upload-Content-Type: application/msword
X-Upload-Content-Length: 7654321

but how could I send such a request using javascript? I've already
tried to add xdh:Authorization, but that didn't work, any body know
how to do?

--
You received this message because you are subscribed to the Google Groups "Google Data Javascript Client" group.
To post to this group, send email to google-data-ja...@googlegroups.com.
To unsubscribe from this group, send email to google-data-javascri...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-data-javascript-client?hl=en.

Bobby

unread,
Apr 29, 2010, 12:42:02 PM4/29/10
to Google Data Javascript Client
I have been able to upload files using the following plain HTML:

<html>
<body>
<form action="https://docs.google.com/feeds/default/media/document
%3A<document id>" method="POST">
<input type="hidden" name="xdp:alt" value="json-xd" />
<input type="hidden" name="xdh:Authorization" value="AuthSub
token=<token>" />
<input type="hidden" name="xdh:GData-Version" value="3.0" />
<input type="hidden" name="xdh:Content-Type" value="text/plain" />
<input type="hidden" name="xdh:If-Match" value="<etag or * if you
don't care>" />
<input type="hidden" name="xdh:X-HTTP-Method-Override" value="PUT" />
<textarea name="xdp:body">Whatever value you want here!</textarea>
<input type="submit" value="update" />
</form>

Replace <token> with your AuthSub token and provide a value for the
etag, such as "*". You can dynamically build the form with JS and
submit.

Bobby

Bobby

unread,
Apr 29, 2010, 12:46:21 PM4/29/10
to Google Data Javascript Client
This is for editing document contents by <documentId>, so not exactly
what you're asking about, but should be a good starting point.

Bobby

disor...@gmail.com

unread,
Apr 30, 2010, 2:22:48 AM4/30/10
to google-data-ja...@googlegroups.com, Google Data Javascript Client
What I want is to send a file using a form like yours, just use <input
type=file> instead of <textarea>. But seems I cannot do that, an empty
file was created in google doc, but content was not set although i'm
sure that file content was sent to google from the monitor



在 Apr 30, 2010,12:46 AM,Bobby <bobby...@gmail.com> 写到:
Reply all
Reply to author
Forward
0 new messages