MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / addFileHttpPart

Function addFileHttpPart

CrashReporter/CallbacksManager.cpp:664–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662}
663
664static void
665addFileHttpPart(QHttpMultiPart* multiPart,
666 const QString& name,
667 const QString& filePath)
668{
669 QFile *file = new QFile(filePath);
670
671 file->setParent(multiPart);
672 if ( !file->open(QIODevice::ReadOnly) ) {
673 std::cerr << "Failed to open the following file for uploading: " + filePath.toStdString() << std::endl;
674
675 return;
676 }
677
678 QHttpPart part;
679 part.setHeader( QNetworkRequest::ContentTypeHeader, QVariant( QString::fromUtf8("text/dmp") ) );
680 part.setHeader( QNetworkRequest::ContentDispositionHeader, QVariant( QString::fromUtf8("form-data; name=\"") + name + QString::fromUtf8("\"; filename=\"") + file->fileName() + QString::fromUtf8("\"") ) );
681 part.setBodyDevice(file);
682
683 multiPart->append(part);
684}
685
686static QString
687getVersionString()

Callers 1

Calls 4

toStdStringMethod · 0.80
setHeaderMethod · 0.80
appendMethod · 0.80
openMethod · 0.45

Tested by

no test coverage detected