Search code examples
c++qtsamba

qt transfer a file from local to a samba shared


I'm newly hired junior programmer, and I'm new in c++ world with no background in linux or networks. We are using gcc 4.7.3 and ubuntu 11.04. I need to know how to transfer file from my local desktop (example /home/username/desktop) to a samba (example smb://192.168.0.54/folder or smb://username/folder). First, I'm trying to do this (if I can access it)

  QDir dir("smb://192.168.0.54/htdocs/");
  if (!dir.exists()) {
      QMessageBox::about(NULL, "DIR", "dir does not exists");
  }
  else
      QMessageBox::about(NULL, "DIR", "dir exists");

and the result is "does not exist". Can someone show me how to transfer files from my local desktop to an smb://?


Solution

  • You can not do that QFile just spports local files but you can mount it to a posix folder and access to that folder.

    You can find a guide about how to mount a samba shared folder here