Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Qt Uploading music to website [SOLVED]

    General and Desktop
    2
    7
    1181
    Loading More Posts
    • 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.
    • BlackMamba
      BlackMamba last edited by

      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 Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        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 Reply Quote 0
        • BlackMamba
          BlackMamba last edited by

          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 Reply Quote 0
          • Chris Kawa
            Chris Kawa Moderators last edited by

            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 Reply Quote 0
            • BlackMamba
              BlackMamba last edited by

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

              1 Reply Last reply Reply Quote 0
              • Chris Kawa
                Chris Kawa Moderators last edited by

                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 Reply Quote 0
                • BlackMamba
                  BlackMamba last edited by

                  Thank you very much. Mark as solved !
                  Cheers

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post