I'm trying to upload an image from an iPhone app by posting it to a form 
and processing it with the following code:

def index():
    form = SQLFORM.factory(
        Field('title'),
        Field('price'),
        Field('image', 'upload', 
uploadfolder=request.folder+'static/uploads'))
    if form.accepts(request.vars):
        image = db.item.image.store(request.vars.image.file, 
request.vars.image.filename)
        db.item.insert(title=form.vars.title, price.form.vars.price, 
image=image)
        return 'ok'
    elif form.errors:
        return 'error'
    return 'start'

The image actually gets saved properly at:
no_table.image.9ca57d942db5deac.613039626131302e6a7067.jpg

However another corrupted 0 kb file is saved at:
item.image.b7e6bb3fedeadf9e.613039626131302e6a7067.jpg

And this is the filename that goes into the db.

Any ideas?

Reply via email to