implement download and open from the cloud browser

This commit is contained in:
2017-11-06 10:07:19 +00:00
parent 05c5bd1bdb
commit fc402d584a
7 changed files with 54 additions and 27 deletions

View File

@@ -63,6 +63,23 @@ void App::initLog()
LogRemote::I.file_init();
}
void App::download(std::string filename)
{
CURL *curl = curl_easy_init();
if (curl)
{
auto dest = data_path + "/" + filename;
FILE* fp = fopen(dest.c_str(), "wb");
std::string url = "http://omigamedev.ddns.net:8080/panoview/cloud-dwl.php?file=" + filename;
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_data_write);
auto err = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fp);
}
}
void App::upload(std::string filename)
{
CURL *curl;