Sorry for the delay.  Yes, that was the problem.  I didn't realize
that I had to generate a new URL every time.  I have now added
Javascript code to make an xmlhttpRequest to get an upload URL before
the the phone app tries to upload the file.  Thanks!

On Aug 10, 12:28 am, Robert Kluin <robert.kl...@gmail.com> wrote:
> Hi,
>   Are you correctly generating an upload url?
>    http://code.google.com/appengine/docs/python/blobstore/overview.html#...
>
> Robert
>
>
>
>
>
>
>
> On Mon, Aug 8, 2011 at 16:37,misteff25<mistef...@gmail.com> wrote:
> > I am trying updload a picture from a Phonegap application to my Python
> > App Engine project.  The phone app trys to upload the file but App
> > engine returns a "list index out of range" error.  Most of this code
> > is very similar to some of the sample projects.
>
> > I have the following code on the App Engine side to handle the files,
>
> >        class UploadHandler(blobstore_handlers.BlobstoreUploadHandler):
> >                def post(self):
> >                upload_files = self.get_uploads('file')  # 'file' is file 
> > upload
> > field in the form
> >                blob_info = upload_files[0]
> >                self.redirect('/serve/%s' % blob_info.key())
>
> > And the following code on the PhoneGap side,
>
> >        function uploadImage() {
> >            var smallImage = document.getElementById('cameraImage');
> >            if (smallImage.src && smallImage.src !== "") {
> >                var f = new FileTransfer();
> >                f.upload(smallImage.src, "http://testtest.appspot.com/
> > upload",
> >                    // success callback
> >                    function(result) {
>
> > document.getElementById('uploadProgress').innerHTML =
> >                            result.bytesSent + ' bytes sent';
> >                        alert(result.responseCode + ": " +
> > result.response);
> >                    },
> >                    // error callback
> >                    function(error) {
> >                        alert('error uploading file: ' + error.code);
> >                    },
> >                    // options
> >                    { fileName: 'myImage.jpg',
> >                      params: { 'username':'jtyberg' }
> >                    });
> >            }
> >        }
>
> > The errir us as follows,
>
> > "POST /upload HTTP/1.1" 500 487 - "BlackBerry9550/5.0.0.469 Profile/
> > MIDP-2.1 Configuration/CLDC-1.1 VendorID/-1" "testtest.appspot.com"
> > ms=416 cpu_ms=93 api_cpu_ms=0 cpm_usd=0.014221 loading_request=1
> > instance=00c61b117ca6c4ea405471eea592a8f79ac6
> >        E 2011-08-06 11:49:17.309
> >        list index out of range
> >        Traceback (most recent call last):
> >                File 
> > "/base/python_runtime/python_lib/versions/1/google/appengine/
> > ext/webapp/__init__.py", line 702, in __call__
> >                handler.post(*groups)
> >                File "/base/data/home/apps/s~testtest/1.352363227571120815/
> > main.py", line 62, in post
> >                blob_info = upload_files[0]
> >        IndexError: list index out of range
>
> > --
> > 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.
> > For more options, visit this group 
> > athttp://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.
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to