When moving files around locally within my project I'm able to use

return QFile::copy(fromPath, toPath);

I need to do something similar but with the fromPath being located on the web.

What is the best way to accomplish this?

有帮助吗?

解决方案

QFile works with local file only.

If you want to copy remote file from web, then you need to download it using QNetworkAccessManager

其他提示

Install on your source and destination machine ssh. Then do a scp via QProcess. This is one way. The best? Depends on your requirements. You can also write a program for your destination machine, which accepts incoming TCP connections from your source machine. Then you connect via QTcpSocket and send your data. Qt4 has a QFtp class. Never used it. Is also a dead end, since it does not exist anymore in Qt5. But maybe it is good enough for your current needs.

I hope you did not expect a more specific answer. There is not 'remoteQFile::copy' command. And there is no general 'best way'.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top