我有一个功能,可以将文件从我的系统加密并上传到服务器。在我尝试关闭时上传文件后,出现错误。错误代码是12030.我的代码的上传部分如下所示。该代码在关闭文件时产生错误的问题是什么。
CFile fp;
UINT uNoOfBytes;
UINT uNoOfEncBytes;
bool bIsFinalBlock = false;
BYTE* pBuf = NULL;
HINTERNET m_hRequest;
if(!fp.Open(szFilePath, CFile::modeRead | CFile::shareDenyNone, &err))
{
AfxThrowFileException(err.m_cause, err.m_lOsError, err.m_strFileName);
}
do
{
uNoOfBytes = fp.Read( pBuffer, DATA_CHUNK_SIZE );
if( uNoOfBytes < DATA_CHUNK_SIZE )
{
bIsFinalBlock = true;
}
uNoOfEncBytes = aes.Encrypt(pBuffer,(int)uNoOfBytes, bIsFinalBlock);
if (!(bRet=InternetWriteFile( m_hRequest, (BYTE*)pBuffer, uNoOfEncBytes,NULL)))
{
DWORD dw = GetLastError();
break;
}
if(bIsFinalBlock)
break;
}while ( uNoOfBytes != 0 ) ;
fp.Close();