Hi Thomas,
Thank you very much for your answer.
It worked with your solution.
Thanks very much.

Regards,
Rajarajan B

On Mar 14, 4:52 pm, Thomas Guettler <[EMAIL PROTECTED]> wrote:
> Python documentation for file():
>
> """...If mode is omitted, it defaults to |'r'|. When opening a binary
> file, you should append |'b'| to the mode value for improved
> portability. (It's useful even on systems which don't treat binary and
> text files differently, where it serves as documentation.)
> """
>
> try this:
> file(fullpath, "rb").read()
>
> Rajaschrieb:
>
>
>
>
>
> > Hi
> > I am designing a web page in django.
> > I am trying to give an option to users that they can download the
> > available files from my site.
>
> > Here is the code.
>
> > response = HttpResponse(file(fullpath).read())
> > response['Content-Type'] = 'application/jpg'
> > response['Content-disposition'] = 'Attachment'
>
> > The above code works fine when files with txt and html extensions are
> > downloaded provided the response['Content-Type'] is changed
> > accordingly.
>
> > When files with jpg ( and similar. Also includes png, bmp,
> > etc... )and
> > exe are downloaded, the files are getting downloaded without any
> > problem. But the content inside the downloaded file is wrong.
> > But this problem doesn't exists with txt and html files.
>
> > I have tried with ['Content-Type'] = 'application/jpg'
> > ['Content-Type'] = 'image/jpg'
> > ['Content-Type'] = 'application/x-download'
>
> > But it doesn't works. So kindly help me to get rid off this problem.
>
> > Thanks and Regards,
> >Raja
>
> --
> Thomas Guettler,http://www.thomas-guettler.de/
> E-Mail: guettli (*) thomas-guettler + de- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to