But I did upload and the image is in the folder.

On Mon, Nov 11, 2019 at 3:48 PM Ruslan Gareev <neor...@gmail.com> wrote:

> Hi, looks like your request.args(0) is empty.
>
> понедельник, 11 ноября 2019 г., 15:37:31 UTC+5 пользователь Maurice Waka
> написал:
>>
>> I'm trying to retrieve an uploaded image from the uploads folder using
>> this
>> <http://www.web2pyslices.com/article/show/1522/generate-a-thumbnail-that-fits-in-a-box?commentlimitby=0%2C15#comment_1419>
>> example.
>>
>> I keep on being redirected back to the index page.
>>
>> I also tried this option with the same result.
>>
>> This is the controller code:
>>
>> def showarticle():
>>     id = request.args(0) or redirect(URL('default', 'index'))
>>     article = Article[id]
>>     try:
>>         import os
>>         from PIL import Image
>>     except:
>>         return
>>     stream=Image.open(request.folder + 'uploads/' + id)
>>     return response.stream(stream, attachment=False, article=article)
>>
>> How can I get this right?
>> Regards
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/GbwQoJymKns/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/d9f38307-39a9-4b1b-b126-a440a8ad8d07%40googlegroups.com
> <https://groups.google.com/d/msgid/web2py/d9f38307-39a9-4b1b-b126-a440a8ad8d07%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CALkNK55wO3QXDs6y4yLhYpeMyAWg0wxtW92U%3Dhu2VxbjdfuHWg%40mail.gmail.com.

Reply via email to