Results 1 to 2 of 2

Thread: Http server : send images

  1. #1
    Join Date
    Oct 2009
    Unix/X11 Windows

    Default Http server : send images

    Hi there!

    I'd like to be able to create a server that can send images (stored in his memory) when a browser asks for it.

    For example, if firefox wants to load this :
    Qt Code:
    To copy to clipboard, switch view to plain text mode 

    I want my server to send the content of the image tree that he has in memory.

    EDIT : I think QTextStream can do what I want, but I don't know how to use it.

    Indeed, when I want to load my image in firefox, it says : "The image [...] cannot be displayed, because it contains errors"

    Any idea
    Last edited by fitzy; 28th October 2009 at 22:57.

  2. #2
    Join Date
    Oct 2009
    Thanked 4 Times in 4 Posts
    Qt products
    MacOS X Unix/X11

    Default Re: Http server : send images

    You have to send a proper HTTP protocol response. This consists of a HTTP 200 line, the headers, a blank line and then the raw image data. Check the web for the exact format.

    You don't need QTextStream at all.
    Disclaimer: Although I work on Qt for Nokia, anything I post here is personal

Similar Threads

  1. Sample of Http server
    By Lele in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2010, 23:43
  2. Simple Threaded Http Server
    By obi in forum Qt Programming
    Replies: 4
    Last Post: 20th October 2009, 10:42
  3. How do I send data with http post request?
    By Morea in forum Qt Programming
    Replies: 13
    Last Post: 21st January 2009, 22:51
  4. A simple HTTP server going wrong.
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2008, 20:09
  5. Connect to a server, send data and exit
    By Pepe in forum Newbie
    Replies: 6
    Last Post: 27th July 2007, 11:29


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.