oops :)

def download():
    if (request.args(0) or '').endswith('.swf'):
        import os
        response.headers['Content-Disposition'] = ''
        filename = os.path.join(request.folder,'uploads',request.args(0))
        return response.stream(open(filename,'rb'))
    else:
        return response.download(request,db)

среда, 3 октября 2012 г., 22:31:30 UTC+5 пользователь LightOfMooN написал:
>
> I have the same problem, which I solved by this way:
>
> def download():
>     if (request.args(0) or '').endswith('swf'):
>         from cStringIO import StringIO
>         import os
>         import time
>         response.headers['Content-Disposition'] = ''
>         filename = os.path.join(request.folder,'uploads',request.args(0))
>         return response.stream(open(filename,'rb'))
>     else:
>         return response.download(request,db)
>
> среда, 6 июля 2011 г., 20:25:57 UTC+5 пользователь miguel написал:
>>
>> It is unlikely that this is web2py related, but I'm about to go crazy 
>> with this one. But I guess it's such a general thing someone must know what 
>> is going on.
>>
>> I'm using different uploaded media, such as files, images and flash files 
>> (.swf files). I can display images without problem, but not flash. Here's 
>> my view template:
>>
>> <object type="application/x-shockwave-flash" width="{{=obj.width}}px" 
>> height="{{=obj.height}}px"
>>              data="{{=URL(r=request,f='download',args=obj.image)}}">
>>   <param name="quality" value="best" /><param name="allowfullscreen" 
>> value="true" />
>>   <param name="scale" value="showAll" /><param name="movie" 
>> value="{{=URL(r=request,f='download',args=obj.image)}}" />
>> </object>
>>
>>
>> The movie does not load and the flash player menu states "Movie not 
>> loaded...". However this should work, since it works fine with static files:
>>
>> <object type="application/x-shockwave-flash" width="360px" height="190px"
>>              data="{{=URL('static/images','teaser_2008012901.swf')}}">
>>   <param name="quality" value="best" /><param name="allowfullscreen" 
>> value="true" />
>>   <param name="scale" value="showAll" /><param name="movie" 
>> value="{{=URL('static/images','teaser_2008012901.swf')}}" />
>> </object>
>>
>> Any tips?
>> Miguel
>>
>

-- 



Reply via email to