Hello lshbit, thank you for your answer, but i think my problem is a bit different. I'm using a custom form as you can see in add_space.html and I use a "photo = request.vars.photo" to insert the data from the form in the database
On Apr 12, 12:28 pm, Ishbir <ishbi...@gmail.com> wrote: > There is an entry regarding this in the book- > > http://web2py.com/book/default/section/3/6 > > It's almost the same stuff.. > > On Apr 12, 3:54 pm, Francisco Costa <m...@franciscocosta.com> wrote: > > > Model > > > db.define_table('space', > > Field('name'), > > Field('slug', 'string'), > > Field('description','text'), > > Field('photo','upload'), > > > Controller > > > def add_space(): > > form='ola'#crud.create(db.space) > > return dict(form=form) > > > def create(): > > name = request.vars.name > > slug = slugify(name) > > description = request.vars.description > > photo = request.vars.photo > > street_name = request.vars.street_name > > ..... > > > Views > > > add_space.html > > > <div id="form"> > > <h2>New Space</h2> > > {{=FORM( > > H1("Create New Space"), > > DIV(("Space Name"), INPUT(_name="name", _size="30")), > > DIV(("Description:"), TEXTAREA(_name="description", _rows="20", > > _cols="60")), > > DIV(("Photo"), INPUT(_name="photo", _size="30", _type="file")), > > DIV(("Street Name"), INPUT(_name="street_name", _size="30")), > > ... > > > view_space.html > > > <p><img src="/{{=app}}/default/download/{{=spaces.photo}}" > > height="150px" style="float:left;"/>{{=XML(spaces.description)}}</p> > > ... > > > On Apr 11, 11:31 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > Please show us your code. > > > > On Apr 11, 1:23 pm, Francisco Costa <m...@franciscocosta.com> wrote: > > > > > Hello, > > > > I'm using a custom form that has an upload field in the model. > > > > When i submit the form I use a request.vars.name and saves the file as > > > > an FieldStorage.. > > > > I don't know if the file is uploaded and how I can access it. > > > > I would like to have the file upload to appname/uploads directory as > > > > if I used a crud form. > > > > > Thank you -- To unsubscribe, reply using "remove me" as the subject.