I need to send files to a PHP script using delphi. I finally decided to use Wininet features because I need to go through the NTLM Authentication proxy.
When I submit the file, I have empty characters (00) between each character of my content request:
POST /upload.php HTTP/1.1 User-Agent: MYUSERAGENT Host: 127.0.0.1 Cookie: ELSSESSID=k6ood2su2fbgrh805vs74fvmk5 Pragma: no-cache Content-Length: 5 TES
Here is my Delphi code:
pSession := InternetOpen('MYUSERAGENT', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); pConnection := InternetConnect(pSession, PChar('127.0.0.1'), INTERNET_DEFAULT_HTTP_PORT, nil, nil, INTERNET_SERVICE_HTTP, 0, 0); pRequest := HTTPOpenRequest(pConnection, PChar('POST'), PChar('/upload.php'), 'HTTP/1.0', nil, nil, INTERNET_SERVICE_HTTP, 0); HTTPSendRequest(pRequest, nil, 0, Pchar('TESTR'), Length('TESTR'));
Any ideas on what's going on?
source share