Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Not able to uplaod mp3 file to soundcloud
Qt 6.12 LTS is out! See what's new in the release blog

Not able to uplaod mp3 file to soundcloud

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 891 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.
  • B Offline
    B Offline
    bhupi012
    wrote on last edited by
    #1

    Is their anyone who worked on QT Soundcloud Integration

    I am trying to upload mp3 files to soundcloud using Qt but not able to upload

    After verifying and getting acces_token

    I am using post to upload mp3 file

    @
    QString uplaodurl = "https://api.soundcloud.com/tracks.json";

    QString file = "C:/Users/Admin/Music/songs/audio.mp3";
    QFile Opfile(file);
    if(Opfile.open(QIODevice::ReadOnly)){

    QEventLoop q;
    QTimer t1;
    t1.setSingleShot(true);

     connect(&t, SIGNAL(timeout()), &q, SLOT(quit()));
    

    QByteArray oauthHeader1 = generateAuthorizationHeaderForSoundClound(url, OAuth::POST);
    QString ohead(oauthHeader1);

    QNetworkRequest req1(uplaodurl);

    req1.setRawHeader(AUTH_HEADER, oauthHeader1);

    QString str = "track[recording]";
    QString str1 = "track title";
    QString assetdata = "track[asset_data]";
    QString str2 = "oauth_token";
    QString path = "C:/Users/Admin/Music/songs/audio";

    //req1.setRawHeader(str1.toUtf8(), str.toUtf8());
    //req1.setRawHeader(assetdata.toUtf8(), path.toUtf8());

    QByteArray arr = Opfile.readAll();
    QString updata(arr);

    QNetworkReply *reply = m_netManager->post(req1, &Opfile);
    connect(reply, SIGNAL(finished()), &q, SLOT(quit()));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error()));

    t1.start(150000);
    q.exec();

    if(t1.isActive()){
    QByteArray response = reply->readAll();
    parseTokens(response);
    reply->deleteLater();

    mHaspin = !m_oauthToken.isEmpty() && !m_oauthTokenSecret.isEmpty();
    

    }
    @

    Response:

    {"errors":[{"error_message":"401 - Unauthorized"}]}

    But if i make get call then respose is positive --

    [edit: added missing coding tags @ SGaist]

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