Hi,
I am trying to use the Google Blobstore API for uploading images. I also
checked the link: http://www.web2pyslices.com/main/slices/take_slice/63 for
the help but couldn't understand much.
In my application's (uploadPic) default controller I have the code as
follows:
from google.appengine.ext import blobstore
def index():
"""
This provides the upload_url to the upload form
"""
upload_url=blobstore.create_upload_url(URL('uploadPic','default','pic'))
return dict(upload_url=upload_url)
def pic():
"""
This method stores the bolb key in a table and is used for serving the
BLOB images
"""
response.write(request)
In the view index.html, I have a simple form
<html>
<body>
<form method='post' action='{{=upload_url}}'
enctype='multipart/form-data'>
<input type='file' name='file'>
<input type='submit' name='submit' value='Upload'>
</form>
</body>
</html>
As per my understanding, when the upload is successful, GAE automatically
redirects to the URL provided in the create_upload_url function with the
request containing the blob_key.
But when I execute the above, all I get in the page is None. The log is
showing the following:
INFO 2012-03-07 09:30:31,188 dev_appserver.py:2865] "GET
/uploadPic/default/index HTTP/1.1" 200 -
INFO 2012-03-07 09:30:37,558 dev_appserver.py:687] Internal redirection
to /uploadPic/default/pic
INFO 2012-03-07 09:30:37,681 gaehandler.py:69] **** Request:
104.29ms/100.00ms (real time/cpu time)
INFO 2012-03-07 09:30:37,686 recording.py:372] Saved; key:
__appstats__:037500, part: 20 bytes, full: 1234 bytes, overhead: 0.000 +
0.004; link: http://localhost:8080/_ah/stats/details?time=1331112637576
INFO 2012-03-07 09:30:37,695 dev_appserver_blobstore.py:447] Upload
handler returned 200
INFO 2012-03-07 09:30:37,723 dev_appserver.py:2865] "POST
/_ah/upload/ag9kZXZ-aW1hZ2V1cGxvYWRyGwsSFV9fQmxvYlVwbG9hZFNlc3Npb25fXxggDA
HTTP/1.1" 200 -
Can someone please help me understand it ?
Thanks,
Sushant