Downloading file works but it corrupts the file

Viewed 41

So, I happened to get my file to download correctly idk if it is corrupting because my web host doesn't allow .exe to be uploaded. So, I changed the file extension to .ex and when it downloads it'll change to .exe. Doing this it downloads but the file is 400kb but it corrupts the file and only downloads 1kb.

HRESULT hr;
LPCTSTR Url = "http://test.com/test.ex", File = "C:\\Users\\Tommy\\Desktop\\test.exe";
hr = URLDownloadToFile(0, Url, File, 0, 0);
switch (hr)
{
case S_OK:
    cout << "Successful download\n";
    break;
case E_OUTOFMEMORY:
    cout << "Out of memory error\n";
    break;
case INET_E_DOWNLOAD_FAILURE:
    cout << "Cannot access server data\n";
    break;
default:
    cout << "Unknown error\n";
    break;
}

Image that it is 400KB on the web server

Image that it does download and corrupts to 1KB

0 Answers
Related