title: QFile to QByteArray save file name
body: <p>I have a <code>QFile</code> that needs to be sent through a LAN network. In order to do so, I convert the <code>QFile</code> into <code>QByteArray</code> by doing:</p>
  
  <pre><code>//! [Inside a QTcpSocket class]
  
  // Get the file name using a QFileDialog
  QFile file(QFileDialog::getOpenFileName(NULL, tr("Upload a file")));
  
  // If the selected file is valid, continue with the upload
  if (!file.fileName().isEmpty) {
      // Read the file and transform the output to a QByteArray
      QByteArray ba = file.readAll();
  
      // Send the QByteArray
      write(ba);
  }
  </code></pre>
  
  <p>When I receive it, I can transform it easily by using:</p>
  
  <pre><code>void saveFile(QByteArray ba) {
      // Ask the user where he/she wants to save the file
      QFile file(QFileDialog::getSaveFileName(NULL, tr("Save file")));
  
      // Check that the path is valid
      if (!file.fileName().isEmpty()) {
         // Write contents of ba in file
         file.write(ba);
         // Close the file
         file.close();
      }
  }
  </code></pre>
  
  <p>However, I would like to know the file name (such as <code>Document.docx</code>) or at least know its extension to avoid forcing the user to know exactly which file type he has received.</p>
  
  <p>Ideally, when the file is uploaded, the receiver user will be prompted to save the file. For example:</p>
  
  <ol>
  <li>Sender sends <code>Document1.docx</code></li>
  <li>Receiver gets prompted if he/she wants to save <code>Document1.docx</code></li>
  <li>Based on receiver's decision, <code>Document1.docx</code> is saved in receiver's workstation.</li>
  </ol>
  
  <p>So, my question is: Is there any way to know the name and extension of a <code>QFile</code> when its transformed into a <code>QByteArray</code> and then transformed again (in another computer) into a <code>QFile</code>?</p>