Hello all
i'm trying to upload a file from my local system to a http web server (currently localhost) . the code is based on http://support.microsoft.com/kb/184352/
This caused error and didn't create a file , then i added HttpSendRequest (hRequest, NULL, 0, NULL, 1); before the HttpSendRequestEx , and this create a file in the server . the HttpEndSession returns ERROR_INTERNET_FORCE_RETRY again and again .
How to make it work correct ?
I have seen many threads in this site regarding this problem , but didn't saw any solution to this .
You mean added a code to Send request of 0 bytes ? Thats wrong, you have sent optional data as NULL and specified it's size as 1 byte, it should not be used that way.
Also what was the problem with original code on M$ support site ? what line does it fail ? What's last error(GetLastError()) ?
ohh..ok .. i changed that code..well still now nothing positive happens
it just create a zero sized file . the problem with M$ code was ..it doesn't create anything .
all functions succeed except the endsession returns error code 12032 (ERROR_INTERNET_FORCE_RETRY ) , and if retried the next endsession function timesout .
Hello, I remember a while ago I tried to get that example to work and didn't manage so I wrote a wrapper for InternetWriteFile (in a slightly different manner) to handle the upload. Here's the code, maybe it'll help you
You might have to register your file MIME type, I don't remember if you have to do this or not. In IIS expand your site, select the directory in which you want to save the file and open the Properties dialog. Go to the HTTP Headers tab and click on the "MIME Types" button. Now add a new MIME. I hope this works for you.
P.S. It doesn't work as in it doesn't create anything or still only creates a 0-length file?
I have made a small error in the code I have previously posted. I have attached a .h file that contains the code for the Wrapper. I have tested it and it works.
still not working . creates a zero byte file.
i'm running ur code in winxp with iis5.1 . is there any settings u have done ? .
after/during the the httpsendrequestex call i get some exceptions
Code:
'InternetConnect.exe': Loaded 'C:\WINDOWS\system32\oleaut32.dll', No symbols loaded.
'InternetConnect.exe': Loaded 'C:\WINDOWS\system32\dnsapi.dll', No symbols loaded.
First-chance exception at 0x7c812a5b in InternetConnect.exe: 0x000006BA: The RPC server is unavailable.
First-chance exception at 0x7c812a5b in InternetConnect.exe: 0x000006BA: The RPC server is unavailable.
First-chance exception at 0x7c812a5b in InternetConnect.exe: 0x000006BA: The RPC server is unavailable.
First-chance exception at 0x7c812a5b in InternetConnect.exe: 0x000006BA: The RPC server is unavailable.
'InternetConnect.exe': Loaded 'C:\WINDOWS\system32\hnetcfg.dll', No symbols loaded.
'InternetConnect.exe': Loaded 'C:\WINDOWS\system32\wshtcpip.dll', No symbols loaded.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.