| 
 Ученик-кочегар
 
 Группа: Участник
 Сообщений: 1
 
 
 
  
 | Не могу решить одну проблему... Создаю сервер IdHTTPServer...
 Клиенту в веб-браузере генерируется страничка, которая просит задать файл для Upload. (Такая как на народ.ру).
 Код странички такой:
 
 | CODE |  | <html> 
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
 <title>New Page</title>
 </head>
 
 <body>
 
 <form method="POST"  action="http://127.0.0.1:7133/">
 <p><input type="file" name="F1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2" style="height: 26px"></p>
 </form>
 
 </body>
 
 </html>
 | 
 
 В моем же сервере надо принять этот файл!!!!
 Очень долго ищу ответ.... Нашел вот как сделать это в Делфи, НО...
 | CODE |  | procedure TForm1.ServerCommandGet(AThread: TIdPeerThread; ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
 Var PostedFile:TMemoryStream;
 begin
 
 If ARequestInfo.Document='/' Then begin
 With AResponseInfo do begin
 ContentText:=HtmlForm;
 WriteContent;
 end;
 end else if ARequestInfo.Document='/upload/' then begin
 PostedFile:=TMemoryStream.Create;
 Try
 Try
 PostedFile.LoadFromStream(ARequestInfo.PostStream);
 PostedFile.SaveToFile('.\'+(DateToStr(now)+' '+TimeToStr(now)+' '+AThread.Connection.Socket.Binding.PeerIP));
 With AResponseInfo do begin
 ContentText:=HtmlForm('Upload Successful!');
 WriteContent;
 end;
 except
 With AResponseInfo do begin
 ContentText:=HTMLForm('Upload Error!');
 WriteContent;
 end;
 end;
 finally
 PostedFile.Free;
 end;
 end;
 end;
 | 
 
 ... НО в Builder 6 нету такого RequestInfo->PostStream !!!!
 
 Что делать?? Как?? Посоветуйте... Может какой-то альтернативный вариант...
 
 Я вот смотрел AThread->Connection->ReadStream(...) Может этим?? Я пробовал-глухо...
 Помогите пожалуйста.
 |