c++ - Uploading Images, Videos and Zip becomes "Unable to Preview" / "Invalid" -
i can't see similar problem here why made topic.
i making qt c++ application using dropbox core rest api. have no problems authenticating, can upload problem types being invalid after uploaded image files, video files , zips, weird pdfs , mp3 doesn't invalid.
[code - qt c++ code uploading]
// ----- javascript var params = new object(); params.url = "https://api-content.dropbox.com/1/files_put/"+currentpath+"/"+basefilename+"?access_token=" + dropboxaccesstoken params.filename = filename; params.basefilename = basefilename; params.endpoint = "dropboxupload"; uploader.uploaddropbox(params); // ----- cpp qvariantmap paramsmap = params.tomap(); const qstring endpoint = paramsmap.value("endpoint").tostring(); const qstring filename = paramsmap.value("filename").tostring(); const qstring basefilename = paramsmap.value("basefilename").tostring(); const qstring theurl = paramsmap.value("url").tostring(); qhttpmultipart *multipart = new qhttpmultipart(); qhttppart filepart; qfile *file = new qfile(filename); file->open(qiodevice::readonly); filepart.setbodydevice(file); file->setparent(multipart); multipart->append(filepart); qurl urlquery(theurl); qnetworkrequest request(urlquery); qnetworkreply *reply = networkaccessmanager.post(request, multipart); reply->setproperty("endpoint", endpoint); multipart->setparent(reply); connect (reply, signal(finished()), this, slot(oncomplete())); [image - highlighted files fine, rest invalid files when opened] 
[image - unable preview] 
[image - pdf file opened without problems] 
any suggestions please?
i have solved problem
qvariantmap paramsmap = params.tomap(); const qstring endpoint = paramsmap.value("endpoint").tostring(); const qstring filename = paramsmap.value("filename").tostring(); const qstring basefilename = paramsmap.value("basefilename").tostring(); const qstring theurl = paramsmap.value("url").tostring(); qhttppart filepart; qfile *file = new qfile(filename); file->open(qiodevice::readonly); qurl urlquery(theurl); qnetworkrequest request(urlquery); qnetworkreply *reply = networkaccessmanager.put(request, file->readall()); reply->setproperty("endpoint", endpoint); connect (reply, signal(finished()), this, slot(oncomplete()));
Comments
Post a Comment