Created simple gui for uploading a song and implemented the functionality. #1 and #2

This commit is contained in:
amazing-username
2019-03-23 21:17:24 -04:00
parent 99e35217eb
commit e81b4ecdb1
7 changed files with 90 additions and 37 deletions
+10 -6
View File
@@ -12,6 +12,9 @@ using std::string;
using json = nlohmann::json;
using Managers::FileManager;
using Models::UploadForm;
using namespace cpr;
namespace Syncers
@@ -20,22 +23,23 @@ namespace Syncers
Upload::Upload(string filePath)
{
this->songPath = filePath;
this->fMgr = Managers::FileManager(songPath);
this->fMgr = FileManager(songPath);
}
Upload::Upload(UploadForm formData)
{
this->url = formData.url;
this->songPath = formData.filePath;
}
void Upload::uploadSong()
{
configureSongDemo();
string url = apiUrl + ":" + std::to_string(port) + apiEndPoint;
try
{
auto r = cpr::Post(cpr::Url{url},
cpr::Multipart{{"key", "small value"},
{"file", cpr::File{songPath}}});
cout << r.text << std::endl;
cout << r.status_code<< std::endl;
cout<<"Success"<<endl;
}