Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] QUrl "file:" scheme trouble
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QUrl "file:" scheme trouble

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 4.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sht1rlitz
    wrote on last edited by
    #1

    @QUrl urlpath("file://192.168.0.1/somedir/somedoc.txt");
    qDebug()<<urlpath.errorString();@ tell "Invalid URL".
    I'm trying to get some file from network via the QNetworkAccessManager. Can anybody show me mistake, please?
    Thnx for any help!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      URLs contain the protocol used to access some resource on the network, not what you want to access.

      So "file://" does not state that you want to download a file but that you are accessing a resource in your local filesystem. file urls can not contain a host. Try "file:///somedir/somedoc.txt" instead (note the three slashes).

      Since file urls can never point to remote locations it makes little sense to involve the networkaccessmanager to get them.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sht1rlitz
        wrote on last edited by
        #3

        Hmm... Strange. I thought it's ok. From WIKI:

        bq. To access a file "the file.txt", the following might be used.
        For a network location:
        file://hostname/path/to/the file.txtbq.

        Thank you anyway!

        P.S.: is there a simple way to get file from shared folder?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          Mount the shared folder and then you can access files there like any other local file.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sht1rlitz
            wrote on last edited by
            #5

            Thanks a lot! I'll try it.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved