Box API: the speed of upload file
I'm working on an application that can upload files.Now, I can upload files, but the speed is too slow.
For example, I try to upload a file on the website, the speed is 4MB/s, but when I upload the same file with my application, the speed is 360KB/s.
I'm using c++ and the libcurl to upload files.
Anyone can tell me what's the matter?
Thanks!
codes
Json::Value parentVal; parentVal["id"] = "0"; Json::Value attributeVal; attributeVal["name"] = strFileName.c_str(); attributeVal["parent"] = parentVal; Json::FastWriter fast_write; string strAttribute = fast_write.write(attributeVal); curl_formadd(&m_formPost, &m_formPostLast, CURLFORM_COPYNAME, "attributes", CURLFORM_COPYCONTENTS, strAttribute.c_str(), CURLFORM_END); strFileName = strFileName.substr(0, strFileName.find(".")); curl_formadd(&m_formPost, &m_formPostLast, CURLFORM_COPYNAME, "file", CURLFORM_FILE, strLocalFile.c_str(), CURLFORM_END); curl_formadd(&m_formPost, &m_formPostLast, CURLFORM_COPYNAME, "submit", CURLFORM_COPYCONTENTS, "send", CURLFORM_END);
curl_easy_setopt(m_handle, CURLOPT_POST, 1L); curl_easy_setopt(m_handle, CURLOPT_URL, strUrl.c_str()); curl_easy_setopt(m_handle, CURLOPT_HTTPHEADER, m_headerList); curl_easy_setopt(m_handle, CURLOPT_HTTPPOST, m_formPost); curl_easy_setopt(m_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)getFileSize(strLocalFile.c_str()));
Please sign in to leave a comment.
Comments
1 comment