On Nov 12, 6:29 am, vikash rai <vikasloves...@gmail.com> wrote:
> 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 ?

Have you enabled mod_xsendfile in Apache, and configured it properly?
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to