There a number of problems. comments below:
On Apr 12, 5:54 am, Francisco Costa <[email protected]> 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) #<<<<< 'ola'?
> 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
> .....
Not sure what this is supposed to do the ... do not help
>
> 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")),
> ...
You are passing form to this view but your are not using it. You
should else it may not pass validation.
{{=form.cutsom.begin}}
...
{{=form.custom.end}}
> view_space.html
>
> <p><img src="/{{=app}}/default/download/{{=spaces.photo}}"
> height="150px" style="float:left;"/>{{=XML(spaces.description)}}</p>
> ...
Looks all right but I do not know what the controller for this looks
like
> On Apr 11, 11:31 pm, mdipierro <[email protected]> wrote:
>
> > Please show us your code.
>
> > On Apr 11, 1:23 pm, Francisco Costa <[email protected]> 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.