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. Qt Uploading music to website [SOLVED]

Qt Uploading music to website [SOLVED]

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 1.5k Views
  • 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.
  • BlackMambaB Offline
    BlackMambaB Offline
    BlackMamba
    wrote on last edited by
    #1

    Hello,
    I am working on an audio application which creates audio files. I would like to give the user the possibility to upload this file on my website www.mysite.com.
    Is it possible to achieve this?
    What would be the way to go?
    Cheers

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Sure it's possible.
      You can use QNetworkAccessManager "post":http://qt-project.org/doc/qt-5/qnetworkaccessmanager.html#post-2 method to connect to your website and upload a file.
      Of course you'll need to provide some authorization mechanism and a service that can receive files on the server side.

      1 Reply Last reply
      0
      • BlackMambaB Offline
        BlackMambaB Offline
        BlackMamba
        wrote on last edited by
        #3

        Thank you for your help. Could you please give some tips for the second part of your answer? (even if it over extends qt field)
        How would you do that?

        1 Reply Last reply
        0
        • Chris KawaC Offline
          Chris KawaC Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It greatly depends on the technology you use for the server: PHP, Java, Ruby, node.js etc. and the type of protocols you choose: REST, SOAP, XML-rpc etc.
          Then there's server itself - apache, iis, tomcat etc.

          There's like a gazillion possible answers to that question.
          Just google "<your technology> file upload example" and there will be many answers to choose from.

          1 Reply Last reply
          0
          • BlackMambaB Offline
            BlackMambaB Offline
            BlackMamba
            wrote on last edited by
            #5

            Chris, the only constraint I have is to use wordpress for the website ;)

            1 Reply Last reply
            0
            • Chris KawaC Offline
              Chris KawaC Offline
              Chris Kawa
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Well then, as I said: "wordpress file upload example" ;)

              As I recall servers hosting wordpress usually support FTP access, so it could be something like
              @
              QUrl url("ftp://mysizte/files/some_file.mp3");
              url.setUserName("user");
              url.setPassword("password");
              url.setPort(21);

              QFile src("some_file.mp3");
              if (src->open(QIODevice::ReadOnly)) {
              QNetworkReply reply = qnam->put(QNetworkRequest(url), src);
              ...
              @
              This is off the top of my head so some tweaks will surely be needed.
              Of course you can monitor progress and get notified about finish or errors via various reply signals. Read the docs of QNetworkReply and QNetworkAccessManager.

              1 Reply Last reply
              0
              • BlackMambaB Offline
                BlackMambaB Offline
                BlackMamba
                wrote on last edited by
                #7

                Thank you very much. Mark as solved !
                Cheers

                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