使用 libcurl 上传带有特殊字符的文件名
upload file name with special characters using libcurl
尝试使用 curl FTP.
将文件 HU98373+TRRepr#o4_201702061135_34 从本地系统复制到远程目标
在远程系统中,它使用 HU98373+TRRepr 创建了文件,但没有使用 HU98373+TRRepr#o4_201702061135_34。我不知道为什么不考虑'#'字符
请检查以下代码。
remoteFileUrl = ftp://IPADRESS/HOME/HU98373+TRRepr#o4_201702061135_34.tmp/C20170206.1135-20170206.1140
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_URL, remoteFileUrl);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_UPLOAD, ON);
// Set the input local file handle
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_READDATA, localFileHandle);
// Set on/off all wanted options
// Enable ftp data connection
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_NOBODY, OFF);
// Create missing directory into FTP path
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_FTP_CREATE_MISSING_DIRS , ON) ;
// Set the progress function, in oder to check the stop transfer request
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_NOPROGRESS, OFF);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_PROGRESSFUNCTION, progressCb);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_PROGRESSDATA, this);
CURLcode curlOperationResult = curl_easy_perform(m_CurlSessionHandle);
谁能帮我解决这个问题
一个URL由以下部分组成:
scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]
字符#
表示URL片段。您必须 URL 对 #
字符进行编码,这样它就不会被解释为片段分隔符。
编码后,服务器将按预期解析 URL 并生成正确的文件名。
以下问题显示了如何在 C++ 中执行此操作:
Encode/Decode URLs in C++
尝试使用 curl FTP.
将文件 HU98373+TRRepr#o4_201702061135_34 从本地系统复制到远程目标在远程系统中,它使用 HU98373+TRRepr 创建了文件,但没有使用 HU98373+TRRepr#o4_201702061135_34。我不知道为什么不考虑'#'字符
请检查以下代码。
remoteFileUrl = ftp://IPADRESS/HOME/HU98373+TRRepr#o4_201702061135_34.tmp/C20170206.1135-20170206.1140
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_URL, remoteFileUrl);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_UPLOAD, ON);
// Set the input local file handle
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_READDATA, localFileHandle);
// Set on/off all wanted options
// Enable ftp data connection
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_NOBODY, OFF);
// Create missing directory into FTP path
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_FTP_CREATE_MISSING_DIRS , ON) ;
// Set the progress function, in oder to check the stop transfer request
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_NOPROGRESS, OFF);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_PROGRESSFUNCTION, progressCb);
curl_easy_setopt(m_CurlSessionHandle, CURLOPT_PROGRESSDATA, this);
CURLcode curlOperationResult = curl_easy_perform(m_CurlSessionHandle);
谁能帮我解决这个问题
一个URL由以下部分组成:
scheme:[//[user:password@]host[:port]][/]path[?query][#fragment]
字符#
表示URL片段。您必须 URL 对 #
字符进行编码,这样它就不会被解释为片段分隔符。
编码后,服务器将按预期解析 URL 并生成正确的文件名。
以下问题显示了如何在 C++ 中执行此操作:
Encode/Decode URLs in C++