View Full Version : Server directory
fitzy
3rd October 2009, 20:34
Hi,
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
http://localhost:4242/DIRECTORY-1/
http://localhost:4242/DIRECTORY-2/
How can I do it ? :confused:
fitzy
4th October 2009, 11:13
Any idea ?
ChrisW67
4th October 2009, 22: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.
http://localhost:4242/DIRECTORY-1/
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.
fitzy
6th October 2009, 20:51
Ok thank you very much :)
Now, let's say I want to load an image like this :
http://localhost:4242/DIRECTORY-1/tree.png
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:).
faldzip
7th October 2009, 11: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"/>
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.