Anthony,

Am having a very funny behavior. I am loading a form in a component
quotes.load in another page of a <div>.
When i access the component directly through the URL address the
{{=BEAUTIFY(request.vars)}} am able to see the uploaded file, but accessing
it through the component its sending empty quotes upload file note the code:

controller

def quotes():
    form = SQLFORM.factory(Field("first_name"), Field("quotes", "upload",
uploadfolder=os.path.join(request.folder,'uploads')))

    file_name=""

    first_name = ""

    if request.vars.quotes:
          file_name="test"

    if request.vars.first_name:
        first_name = "Testing"

    return dict(form=form, file_name = file_name, first_name = first_name)





view::-------->>>>>>>

First name is: {{=file_name}}<br>

        {{=form}}<br>

        First name is:{{=first_name}}

filename is returning empty all the time.


On Wed, Mar 20, 2013 at 3:21 PM, Anthony <abasta...@gmail.com> wrote:

> As is, your code should generate an error because you haven't specified an
> upload folder, which is required when passing new Field objects to
> SQLFORM.factory. Try:
>
>     import os
>     SQLFORM.factory(Field("quotes", "upload", uploadfolder=os.path.join(
> request.folder, 'uploads')))
>
> If you don't want to save the file at all, though, then don't call
> form.process(). Instead, just check for the uploaded file:
>
>     if request.vars.quotes:
>         manage_quotes(request.vars.quotes.file)
>
> Anthony
>
> On Wednesday, March 20, 2013 8:30:29 AM UTC-4, software.ted wrote:
>>
>> I want to upload a file to web2py and then manipulate it. I dont want to
>> save it into the database...after manipulating it i want to delete it. How
>> do i do that. I have been trying like this but all fails:
>>
>> Controller:
>>
>> def quotes():
>>     form = SQLFORM.factory(Field("quotes"**, "upload")
>>     if form.process().accepted:
>>         manage_quotes(form.vars.**quotes)
>>     elif form.errors:
>>         response.flash = "form has error"
>>
>> After upload I cannot see the uploaded in the upload folder!
>>
>> regards
>>
>>
>>
>> --
>> ..............................**..............................**
>> ...........................
>> Teddy Lubasi Nyambe
>> Opensource Zambia
>> Lusaka, ZAMBIA
>>
>> Cell: +260 97 7760473
>> website: http://www.opensource.org.zm
>>
>> ~/
>> Human Knowledge belongs to the world! - AntiTrust
>>
>> Man is a tool-using animal. Without tools he is nothing, with tools he is
>> all - Thomas Carlyle 1795-1881
>>
>> /~
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
.......................................................................................
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to