MCPcopy Create free account
hub / github.com/ON4QZ/QSSTV / uploadFile

Method uploadFile

src/utils/ftpthread.cpp:250–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250void ftpThread::uploadFile(QString source,QString destination)
251{
252 int id;
253 Q_UNUSED(id);
254 addToLog("uploadFile",LOGFTPTHREAD);
255 if (source.isEmpty() )
256 {
257 addToLog("fileName is empty",LOGFTPTHREAD);
258 lastError=FTPERROR;
259 lastErrorStr="Filename is empty";
260 destroy();
261 emit commandsDone((int)lastError,lastErrorStr);
262 return;
263 }
264 sourceFn=new QFile(source);
265 if ( !sourceFn->open( QIODevice::ReadOnly ) )
266 {
267 addToLog(QString("Unable to read '%1'").arg(source), LOGFTPTHREAD);
268 lastError=FTPERROR;
269 lastErrorStr=QString("Unable to read '%1'").arg(source);
270 destroy();
271 emit commandsDone((int)lastError,lastErrorStr);
272 return;
273 }
274 QFileInfo fi( source );
275 QFileInfo fin(destination);
276 addToLog(QString("'%1' put '%2', %3 bytes").arg(idName).arg(destination).arg(sourceFn->size()),LOGFTPTHREAD);
277 ftpDone=false;
278 doConnect();
279 if(fin.fileName().isEmpty()) // no target specified, use the same name as the source
280 {
281 id=qftpPtr->put( sourceFn, fi.fileName(),QFtp::Binary);
282 }
283 else
284 {
285 id=qftpPtr->put( sourceFn, fin.fileName(),QFtp::Binary);
286 }
287 addToLog(QString("'%1' put '%2', %3 bytes. id=%4").arg(idName).arg(destination).arg(sourceFn->size()).arg(id),LOGFTPTHREAD);
288}
289
290
291

Callers 3

uploadToRXServerMethod · 0.45
slotRenameListingMethod · 0.45
ftpDRMHybridMethod · 0.45

Calls 3

openMethod · 0.45
sizeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected