Important: Please read the Qt Code of Conduct -

Qt Uploading music to website [SOLVED]

  • 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
    Is it possible to achieve this?
    What would be the way to go?

  • Moderators

    Sure it's possible.
    You can use QNetworkAccessManager "post": 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.

  • 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?

  • Moderators

    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.

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

  • Moderators

    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");

    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.

  • Thank you very much. Mark as solved !

Log in to reply