Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   [Delphi] Функция InternetWriteFile, срочно нужна помощь!! (https://forum.antichat.xyz/showthread.php?t=203665)

RedFern.89 13.05.2010 02:51

[Delphi] Функция InternetWriteFile, срочно нужна помощь!!
 
доброго времени суток уважаемые кодеры! возникла задача отправить файл + PostData на сервер через wininet. Как мне это все реализовать? :confused:

вот кое что написал, а не работает
Код:

procedure HTTPUpload(Remote:String;Data:TMemoryStream);
var create,file_remote_handle:Phandle;
Data_written:cardinal;
hcn : hinternet;
buffer:array[0..512] of char;
_post:string;
begin

_post := 'note=vk&font1=decor&font2=20&orient=h&size1=x&size2=1024x768&rotate=00&flip=0&mini=300x225&opt3[]=zoom&email=';

  create := InternetOpen('Mozilla/4.0 (compatible)', INTERNET_OPEN_TYPE_PRECONFIG , NIL, NIL, 0);
  hcn := internetconnect(create, PCHar(gethost(remote)), 80, nil, nil, internet_service_http, 0, 0);
  file_remote_handle:=httpopenrequest(hcn, 'POST', pchar('/index.php'), 'HTTP/1.1', nil, NIL, INTERNET_FLAG_RAW_DATA, 0);
  httpsendrequest(file_remote_handle, nil, 0, pchar(_post), Length(_post));
        repeat
                FillChar(buffer,sizeof(buffer),#0);
                data.ReadBuffer(buffer,sizeof(buffer));
                InternetWriteFile(file_remote_handle,addr(buffer),sizeof(buffer),Data_Written);
        until (Data_Written<=0)or (data.Position>=data.Size);
  httpendrequest(file_remote_handle, nil, 0, 0);
end;

пытаюсь отослать картинку на savepic.ru


Время: 11:09