diff --git a/lib/i386-linux/uFileCls.ppu b/lib/i386-linux/uFileCls.ppu
new file mode 100644
index 0000000..0c992a9
Binary files /dev/null and b/lib/i386-linux/uFileCls.ppu differ
diff --git a/tgbp.lpr b/tgbp.lpr
index f76e19c..956b85b 100644
--- a/tgbp.lpr
+++ b/tgbp.lpr
@@ -13,7 +13,7 @@
dateutils,
Process,
// internal classes
- uKeyboardCls, uOtherFunctions;
+ uKeyboardCls, uOtherFunctions, uFileCls;
type
diff --git a/tgbp.lps b/tgbp.lps
index 8d2291f..2ebd480 100644
--- a/tgbp.lps
+++ b/tgbp.lps
@@ -3,63 +3,56 @@
-
+
-
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
diff --git a/uFileCls.pas b/uFileCls.pas
new file mode 100644
index 0000000..4a43f6f
--- /dev/null
+++ b/uFileCls.pas
@@ -0,0 +1,72 @@
+unit uFileCls;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils,process;
+
+type
+ TgFile = class(TObject)
+ public
+ constructor Create(tgUrl:String);
+ function SendFileFromUrl(chat_id,fileUrl,caption:String;var mem: TMemoryStream):Boolean;
+ function SendFileFromLocation(chat_id,fullAddPath,caption:String;var mem: TMemoryStream):Boolean;
+ //function
+ private
+ var
+ _TgURL_ : String;
+ protected
+
+ end;
+
+implementation
+
+constructor TgFile.Create(tgUrl:String);
+begin
+ _TgURL_ := tgUrl;
+end;
+
+
+
+function TgFile.SendFileFromLocation(chat_id,fullAddPath,caption:String;var mem: TMemoryStream):Boolean;
+ var
+ r: string;
+ begin
+ if RunCommand('/usr/bin/curl', ['-o', ExtractFileDir(ExeName) +
+ '/catch', _TgURL_ + 'chat_id='+ chat_id + '&caption='+ caption, '-H',
+ 'Content-Type:multipart/form-data','--form','photo=@'+fullAddPath+';type=image/jpeg'],
+ r) then
+ begin
+ mem.LoadFromFile(ExtractFileDir(ExeName) + '/catch');
+ end;
+ Result := True;
+
+ end;
+
+
+
+function TgFile.SendFileFromUrl(chat_id,fileUrl,caption:String;var mem: TMemoryStream):Boolean;
+ var
+ r: string;
+ begin
+
+ if RunCommand('/usr/bin/curl', ['-o', ExtractFileDir(ExeName) +
+ '/tmp', fileUrl, r) then
+ begin
+ Result := SendFileFromLocation(chat_id,ExtractFileDir(ExeName) +
+ '/tmp',caption,mem);
+ end
+ else
+ begin
+ Result := False;
+ Exit;
+ end;
+ //WriteLn('/usr/bin/curl',['-o',ExtractFileDir(ExeName)+'/catch',url]);
+
+ end;
+
+end.
+
+