The K Desktop Environment

KIO::TransferJob *put

Name

KIO::TransferJob *put -- uploads data to a remote URL

Synopsis

  KIO::TransferJob *put(const KURL& url, int permission, bool overwrite, bool resume, bool showProgressInfo)
  

Parameters

url

The end location for your data

permission

Special permissions for your data. This should be set to -1 if there are no special permissions

overwrite

Instructs the ioslave to overwrite anything that may already be there.

resume

Instructs the ioslave to resume a previously aborted transaction.

showProgressInfo

If true (default), a progress info dialog will popup during long downloads.

Description

This operation will start the process of "putting" or sending data to the location specified in the URL. This is used, for instance, to send files to a remote FTP server or do do a PUT request with HTTP. It is not quite a straight-forward as a get() operation... but is still easy enough. The only big difference is that you need to supply your data to upload in response to the dataReq() signal.

Example

  Client::Client()
  {
    KIO::TransferJob *job = KIO::put("ftp://remote.server.com/pub", -1, false, false);
    connect(job,  SIGNAL(dataReq(KIO::Job*, QByteArray&))
            this, SLOT(slotDataReq(KIO::Job*, QByteArray&)));
    connect(job,  SIGNAL(result(KIO::Job*)),
            this, SLOT(slotResult(KIO::Job*)));
  }
 
  void Client::slotDataReq(KIO::Job*, QByteArray& data)
  {
    QCString local_data("My Data");
    data.duplicate(local_data);
  }