A File object isn't really the file, it's a reference to the file and you
can use it to get its associated metadata (permissions,size,etc.) The
example Ikai is referring to creates a new file on disk which isn't allowed
on AppEngine so this isn't going to work. Nicolo, perhaps you can create
your own multi-part http request and post it using the protocol instead of
the API using URLFetch.  An example from the docs is shown below. Definitely
not as easy as the API.

Stephen
www.cortexconnect.com

POST /feeds/content/domainName/siteName HTTP/1.1
Host: sites.google.com
GData-Version: 1.4
Authorization: <your authorization header here>
Content-Length: 7221984
Content-Type: multipart/related; boundary=END_OF_PART
--END_OF_PART
Content-Type: application/atom+xml
<entry xmlns="http://www.w3.org/2005/Atom";>
  <category scheme="http://schemas.google.com/g/2005#kind";
          term="http://schemas.google.com/sites/2008#attachment";
label="attachment"/>
  <link rel="http://schemas.google.com/sites/2008#parent";
type="application/atom+xml"
        
href="https://sites.google.com/feeds/content/domainName/siteName/PARENT_ENTRY_ID"/>
  <title>PDF File</title>
  <summary>HR packet</summary>
</entry>
--END_OF_PART
Content-Type: application/pdf

... pdf contents here ...

--END_OF_PART--


On Tue, Aug 23, 2011 at 1:48 PM, Ikai Lan (Google) <[email protected]>wrote:

> I just took a look at the GData library, and it shouldn't be that hard to
> convert an InputStream to a File instance. Here's something I found
> searching:
>
> http://www.roseindia.net/java/java-conversion/InputstreamToFile.shtml
>
> --
> Ikai Lan
> Developer Programs Engineer, Google App Engine
> plus.ikailan.com | twitter.com/ikai
>
>
>
> On Sun, Aug 21, 2011 at 8:01 AM, Nicolò Brognoli <
> [email protected]> wrote:
>
>> Hello,
>> I want to upload an InputStream object onto Google sites. The sites API
>> manage only "File" objects, but I can't use the OuputStream to generate the
>> File from the InputStream.
>>
>> How can I upload the InputStream object to Google Sites?
>> Should I do that with a POST request? And if so, how can I create such
>> request?
>>
>> Thanks.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/google-appengine-java/-/xu1WcvMjvXMJ.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to