This is the SendImage function
procedure TFYatahonga.SendImage(user_id : string; direct_upload : string; cat_id : string;
media_file : string; thumb_file : string; image_name : string;
host : string; url : string);
var
Source: TIdMultiPartFormDataStream;
begin
Source := TIdMultiPartFormDataStream.Create;
try
Source.AddFormField('action', 'uploadimage');
Source.AddFormField('user_id', user_id);
Source.AddFormField('direct_upload', direct_upload);
Source.AddFormField('cat_id', cat_id);
Source.AddFormField('image_name', image_name);
if media_file<>'' then
begin
Source.AddFile('media_file', media_file, 'image/jpeg');
Source.AddFormField('dummy1', 'eof');
end;
if thumb_file<>'' then
begin
Source.AddFile('thumb_file', thumb_file, 'image/jpeg');
Source.AddFormField('dummy2', 'eof');
end;
IdHTTPConnect.Post(host + url, Source);
finally
Source.Free;
end;
end;
You can call them like this :
SendImage(CfgUserId, cstdirect_upload, categorie, Nfile, NThumbFile, texte, cstHost, YatUrlUpload);
where CfgUserId, cstdirect_upload, categorie, Nfile, NThumbFile, texte, cstHost, YatUrlUpload are param in a WEB Form at the adress :
http://cstHost/YatUrlUploadSoon
Cyrille