Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:02:22+00:00 2026-06-15T14:02:22+00:00

I have my slot being called whenever someone clicks the link and I know

  • 0

I have my slot being called whenever someone clicks the link and I know the file is there because I can retrieve the file name and the amount of bytes the file is just not sure how to s ave it after I call the QFileDialog::getSaveFileName? I know that gives me the name of the file if the user decides to change it but how do I get the location they decide to save it in and then write it to that location.

NB: The file they will download is a word doc if that makes any difference?

void MainWindow::unsupportedContent(QNetworkReply *reply) {

    qDebug() << "Left click - download!";
    qDebug() << "Bytes to download: " << reply->bytesAvailable();

    QString str = reply->rawHeader("Content-Disposition");

    QString end = str.mid(21);
    end.chop(1);

    qDebug() << "string: " << end;

    qDebug() << "File name: " << reply->rawHeader("Content-Disposition");
    qDebug() << "File type: " << reply->rawHeader("Content-Type");
    QString defaultFileName = QFileInfo(end).fileName();
    QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName);
    if (fileName.isEmpty()) return;


    QFile *file = new QFile(fileName);
    file->open(fileName);
    file->write(reply->read(reply->bytesAvailable()));
    file->close();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:02:23+00:00Added an answer on June 15, 2026 at 2:02 pm

    today i explained it on another post so i will link that post here : Post
    i can tell you that you have only to implement a slot that write into the file you created. and call it when readyRead() signal is emitted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a time slot listed in an unordered list (ul li) with a
I have this QT script using webkit. I can download files no problem but
I have a table with the following structure: id int(11), name varchar(250) I have
Say I have a QTableWidget and in each row there is a QComboBox and
I have a background image set to appear in place of/behind an ad slot,
I have a struct like so typedef struct person { int id; char name[20];
Perhaps I'm being over-ambitious, but I'm trying to write a server program which can
So i have this code that works perfectly without the 'file attachment' and sends
I have some slot function defined in my class which do some actions. I
I have a QThread which does a lot of calculations (it can run for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.