![]() |
|
|
|||||||
| Регистрация | << Правила форума >> | FAQ | Пользователи | Календарь | Поиск | Сообщения за сегодня | Все разделы прочитаны |
![]() |
|
|
Опции темы | Поиск в этой теме | Опции просмотра |
|
#1
|
|||
|
|||
|
Доброго времени суток. Как мне програмно организовать загрузку файла на upwap.ru ?
|
|
#2
|
||||
|
||||
|
IdHTTP, Post.
|
|
#3
|
|||
|
|||
|
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,
IdHTTP, StdCtrls,IdMultipartFormData;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
function GetSubStr(InputStr, BeginStr, EndStr: String): String;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function TForm1.GetSubStr(InputStr, BeginStr, EndStr: String): String;
var
s: String;
sp, ep: Integer;
begin
Result := '';
if pos(BeginStr, InputStr) <> 0 then begin
sp := pos(BeginStr, InputStr)+length(BeginStr);
s := copy(InputStr,sp,length(InputStr));
ep := pos(EndStr,s)-1;
Result := copy(s,1,ep);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
mf:TIdMultiPartFormDataStream;
s,ssilochka:string;
id:TIdHTTP;
begin
id:=TIdHTTP.Create(nil);
mf:=TIdMultiPartFormDataStream.Create;
mf.AddFile('file','file.rar','application/octet-stream');
mf.AddFormField('desc','');
mf.AddFormField('password','666');
mf.AddFormField('send','Отправить!');
s:=id.Post('http://upwap.ru/upload/',mf);
GetSubStr('<input type="text" value="',s,'" /></div></form></div>');
showmessage(s);
id.Free;
end;
end. |
|
#4
|
||||
|
||||
|
А что не так?
|
|
#5
|
|||
|
|||
|
ну по идее должен закачаться файл на сайт и появиться ссылочка на файл
|
|
#6
|
||||
|
||||
|
А что происходит вместо этого?
![]() |
|
#7
|
|||
|
|||
|
визуально-ничего
|
|
#8
|
||||
|
||||
|
Ну а невизуально? Снифферы на что, отладчик?
|