Results 1 to 5 of 5

Thread: Server directory

  1. #1
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    13
    Platforms
    Unix/X11 Windows

    Wink Server directory

    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 ?

  2. #2
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    13
    Platforms
    Unix/X11 Windows

    Unhappy Re: Server directory

    Any idea ?

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Server directory

    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.
    Qt Code:
    1. http://localhost:4242/DIRECTORY-1/
    To copy to clipboard, switch view to plain text mode 
    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.

  4. The following user says thank you to ChrisW67 for this useful post:

    fitzy (6th October 2009)

  5. #4
    Join Date
    Oct 2009
    Posts
    38
    Thanks
    13
    Platforms
    Unix/X11 Windows

    Default Re: Server directory

    Ok thank you very much

    Now, let's say I want to load an image like this :
    Qt Code:
    1. http://localhost:4242/DIRECTORY-1/tree.png
    To copy to clipboard, switch view to plain text mode 

    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 ).

  6. #5
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Server directory

    you can embed image into html inserting it as base64 (read the image file to QByteArray and call toBase64()):
    Qt Code:
    1. <img src="data:image/jpeg;base64,here_paste_the_base64_encoded_image" width="129" height="32"/>
    To copy to clipboard, switch view to plain text mode 
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  7. The following user says thank you to faldzip for this useful post:

    fitzy (8th October 2009)

Similar Threads

  1. some questions about install qwt
    By dycjiaoda in forum Qwt
    Replies: 1
    Last Post: 8th February 2011, 02:37
  2. Replies: 3
    Last Post: 29th November 2009, 21:24
  3. install help nedded.
    By aj2903 in forum Installation and Deployment
    Replies: 9
    Last Post: 13th November 2008, 08:57
  4. qt-3.3.8 fail in scratchbox
    By nass in forum Installation and Deployment
    Replies: 0
    Last Post: 25th May 2007, 16:21
  5. Am I the only one with "make" error ?
    By probine in forum Installation and Deployment
    Replies: 1
    Last Post: 13th February 2006, 13:54

Bookmarks

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.