View Full Version : Server directory

3rd October 2009, 21:34

I have developped a server.

I can access it using firefox, IE, ... thanks to http://localhost:4242/

Now, I would like to be able to create directories, such as

How can I do it ? :confused:

4th October 2009, 12:13
Any idea ?

4th October 2009, 23:22
This is not a Qt-specific question.

Your server needs to do define and implement a set of commands for clients to use.

The way that a web browser does this is to break apart the URL, connect to the designated server process, and send a command to fetch the file at the specified path.


in your browser address bar becomes:

connect to localhost port 4242,
issue the command: "GET /DIRECTORY-1/ HTTP/1.0"
wait for, and interpret, the response
The web server sits waiting for connections, listens to issued commands from clients, and responds to the client.

6th October 2009, 21:51
Ok thank you very much :)

Now, let's say I want to load an image like this :


How is it possible to send the image "tree.png" to the client ?
I tried to send the path of the file (<img src="file:///c:/tree.png" />) but it doesn't work (the browsers don't show it, though the path is correct, I don't get it :confused:).

7th October 2009, 12:51
you can embed image into html inserting it as base64 (read the image file to QByteArray and call toBase64()):

<img src="data:image/jpeg;base64,here_paste_the_base64_encoded_image" width="129" height="32"/>