Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » How to make files with and similar to exe and jpeg [RSS Feed]

#1 March 26, 2008 13:18:16

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

How to make files with and similar to exe and jpeg


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 <> 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 = 'application/jpg'
> > response = 'Attachment'
>
> > The above code works fine when files with txt and html extensions are
> > downloaded provided the response 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 = 'application/jpg'
> > = 'image/jpg'
> > = '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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

  • Root
  • » Django
  • » How to make files with and similar to exe and jpeg [RSS Feed]

Board footer

Moderator control

Enjoy the 11th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support