Thank you Dave, I'm just seeing you reply today but totally appreciated.

On Friday, April 24, 2020 at 8:59:05 AM UTC+2, Dave S wrote:
>
>
>
> On Saturday, April 18, 2020 at 8:57:59 AM UTC-7, mostwanted wrote:
>>
>> I want to download an image but i want it to download with its originally 
>> saved name, is there a way I can modify my download function to do this? So 
>> far its downloading properly as desired its just that its renaming images 
>> with dates e.g:
>> * (IMG-20200418-WA0002)*
>>
>>
>
> I believe what you want to do is to set the headers, something like:
>
> response.headers['Content-Disposition']='attachment;filename=graph.%s'%
> request.args(0)
>
>
> A quick search of the book didn't turn that up, so I must have gotten it 
> from postings in the forum.   The closest my quick search turned up was 
> Content-Type in <URL:
> http://web2py.com/books/default/chapter/29/10/services?search=header>, 
> beginning with generic.xml.
>
> /dps
>
>  
>
>> *IMAGE BEING DOWNLOADED*
>>
>>         {{for details in details:}}
>>         <div class="photos">
>>     <img id="item" src="{{=URL('download',args=details.image)}}" height=
>> "250px" width="250px"/>
>>     <span class="details">
>>     <span>{{=details.name}}</span> *<a href="{{=URL('download', 
>> args=details.image)}}">Download Image</a>*<br />
>>     {{=details.place}}
>>             </span>
>>     {{pass}}
>>     </div>
>>
>> *DOWNLOAD FUNCTION*
>> def download():
>>     return response.download(request, db)
>>
>> Regards;
>>
>> Mostwanted
>>
>>

-- 
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/f9392c2e-cd1b-432c-ad9d-e44f69c479fd%40googlegroups.com.

Reply via email to