Downloading files
Hi,
I am new to django .
From html page I want to download a file from a location in my local
system . I am using django server and not the apache/lightpd.
By the following code I am able to get the dialouge box on clicking the
link on web page .
But it downloads exactly 0 bytes.
Please suggest what to do ?
HTML CODE
<td nowrap>
<a href="/mts/cpd/filename">Download Core</a>
</td>
URLS:
(r'^mts/cpd/filename$','core.srdown')
views/core.srdown :
def srdown(request, id):
paths= str(request.path)
response = HttpResponse(mimetype='application/force-download')
response['Content-Disposition'] = 'attachment; filename=%s' % paths
response['X-Sendfile'] = paths
return response
I get the box asking for downloading but on clicking it downloads file with 0 bytes.
I have given the absolute path to the file '/mts/cpd/filename'. Is that correct ?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home