Could you help me? I can't upload files!!!
This is my code:

----------
upurl = blobstore.create_upload_url('/upload')
----------
<form method="post" action={{ upurl }} enctype="multipart/form-data"/>
 Upload a picture: <input type="file" name="File"/><br>
Caption: <input type="text" name="Frase"/>
 <input type="hidden" name="domain" value="{{ domain }}"/>
<input type="submit"/>
</form>
----------
class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
 def post(self):
upload_files = self.get_uploads('File')
blob_info = upload_files[0]
 self.request.get('Nick')
frasi = FRASI()
frasi.frase = self.request.get('Frase')
 frasi.gruppo = self.request.get('domain')
frasi.link = blob_info.key()
 frasi.Tlink = images.get_serving_url(frasi.link, 94)
frasi.Glink = images.get_serving_url(frasi.link, 400)
 frasi.put()
self.redirect("/" + self.request.get('domain') + "/fanpage")

2010/10/28 Massimiliano <massimiliano.pietr...@gmail.com>

> I can't understand.
> I have removed my serve class and I have added the lines as for your
> example:
>
>  frasi.link = blob_info.key()
> frasi.Tlink = images.get_serving_url(frasi.link, 94)
>  frasi.Glink = images.get_serving_url(frasi.link)
>
> With this lines the upload url returns an error (he can't find the page).
> if I remove this two lines, the upload url is working well, but storing only
> the blob_info.key(). There is something I can't see.
>
>
>
>
> 2010/10/28 Barry Hunter <barrybhun...@gmail.com>
>
> You could store the url in the datastore (after updating your model
>> definion to include the field :)
>>
>> ....
>> > frasi.gruppo = self.request.get('domain')
>> > frasi.link = blob_info.key()
>> frasi.servinglink = images.get_serving_url(frasi.link, 32)
>> > frasi.put()
>> .....
>>
>> Then would just in the template
>>
>> <img src="{{ elemento.servinglink }}" width="10%"/><br></a>
>>
>>
>> ... or you could call get_serving_url in the code that renders the
>> template. You don't need a 'Serve' handler at all :)
>>
>>
>>
>> On 27 October 2010 22:22, Massimiliano <massimiliano.pietr...@gmail.com>
>> wrote:
>> > I do understand this, but my html is:
>> > <img src="/serve/{{ elemento.link }}" width="10%"/><br></a>
>> > How have I to modify the html?
>> > I tried with an Iframe, but doesn't work.
>> > class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
>> > def post(self):
>> > upload_files = self.get_uploads('File')
>> > blob_info = upload_files[0]
>> > self.request.get('Nick')
>> > frasi = FRASI()
>> > frasi.frase = self.request.get('Frase')
>> > frasi.gruppo = self.request.get('domain')
>> > frasi.link = blob_info.key()
>> > frasi.put()
>> > self.redirect("/" + self.request.get('domain') + "/fanpage")
>> > class ServeHandler(webapp.RequestHandler):
>> > def get(self, resource):
>> > self.response.headers['Content-Type'] = "image/png"
>> > self.response.out.write(images.get_serving_url(resource, 32))
>> > 2010/10/27 Barry Hunter <barrybhun...@gmail.com>
>> >>
>> >> get_serving_url is a URL to the file directly - you use it in the
>> >> actual image tag.
>> >>
>> >> self.response.out.write('<img
>> src="%s"/>'%images.get_serving_url(resource,
>> >> 32))
>> >>
>> >>
>> >>
>> >> On 27 October 2010 19:28, Massimiliano <
>> massimiliano.pietr...@gmail.com>
>> >> wrote:
>> >> > I'm trying to serve the images with this code, but it's not working
>> >> > class ServeHandler(webapp.RequestHandler):
>> >> > def get(self, resource):
>> >> > self.response.headers['Content-Type'] = "image/png"
>> >> > self.response.out.write(images.get_serving_url(resource, 32))
>> >> > Could you help me?
>> >> > 2010/10/27 Massimiliano <massimiliano.pietr...@gmail.com>
>> >> >>
>> >> >> I have understand very well the Stephen solution. I'm just fighting
>> >> >> with
>> >> >> the serve part of the code...
>> >> >>
>> >> >> 2010/10/27 ego008 <ego...@gmail.com>
>> >> >>>
>> >> >>> you can do it step by step here
>> >> >>>
>> >> >>>
>> >> >>>
>> http://code.google.com/intl/en/appengine/docs/python/images/usingimages.html
>> >> >>>
>> >> >>>  GAE Geek http://gaefons.appspot.com/
>> >> >>>
>> >> >>> --
>> >> >>> You received this message because you are subscribed to the Google
>> >> >>> Groups
>> >> >>> "Google App Engine" group.
>> >> >>> To post to this group, send email to
>> >> >>> google-appeng...@googlegroups.com.
>> >> >>> To unsubscribe from this group, send email to
>> >> >>> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> >> >>> For more options, visit this group at
>> >> >>> http://groups.google.com/group/google-appengine?hl=en.
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >>
>> >> >> My email: massimiliano.pietr...@gmail.com
>> >> >> My Google Wave: massimiliano.pietr...@googlewave.com
>> >> >
>> >> >
>> >> >
>> >> > --
>> >> >
>> >> > My email: massimiliano.pietr...@gmail.com
>> >> > My Google Wave: massimiliano.pietr...@googlewave.com
>> >> >
>> >> > --
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "Google App Engine" group.
>> >> > To post to this group, send email to
>> google-appeng...@googlegroups.com.
>> >> > To unsubscribe from this group, send email to
>> >> > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> >> > For more options, visit this group at
>> >> > http://groups.google.com/group/google-appengine?hl=en.
>> >> >
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "Google App Engine" group.
>> >> To post to this group, send email to google-appengine@googlegroups.com
>> .
>> >> To unsubscribe from this group, send email to
>> >> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/google-appengine?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> >
>> > My email: massimiliano.pietr...@gmail.com
>> > My Google Wave: massimiliano.pietr...@googlewave.com
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Google App Engine" group.
>> > To post to this group, send email to google-appeng...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> > For more options, visit this group at
>> > http://groups.google.com/group/google-appengine?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To post to this group, send email to google-appeng...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-appengine+unsubscr...@googlegroups.com<google-appengine%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine?hl=en.
>>
>>
>
>
> --
>
> My email: massimiliano.pietr...@gmail.com
> My Google Wave: massimiliano.pietr...@googlewave.com
>



-- 

My email: massimiliano.pietr...@gmail.com
My Google Wave: massimiliano.pietr...@googlewave.com

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appeng...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to