Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi TIdMultipartFormDataStream; Bild via post übertragen (https://www.delphipraxis.net/147354-tidmultipartformdatastream%3B-bild-via-post-uebertragen.html)

DaveRidge 6. Feb 2010 13:32


TIdMultipartFormDataStream; Bild via post übertragen
 
Hallo, ich hab mal ne frage.

Ich möchte eine jpg datei über post versenden.
hab folgenden Code im netz gefunden:

Delphi-Quellcode:
var
  stream : TIdMultipartFormDataStream;
begin
if not OpenDialog1.Execute then Exit;
  ProgressBar1.Min := 0;
  stream := TIdMultipartFormDataStream.Create;
try
  stream.AddFormField('MAX_FILE_SIZE','52428800');
  stream.AddFormField('UPLOAD_IDENTIFIER','UPLOADER');
  stream.AddFile('file',OpenDialog1.FileName,'application/rar');
  Memo1.Text := IdHTTP1.Post('http://meineseite.de/upload.php',stream);
finally
  stream.Free;
end;
Problem nur ich hab die TIdMultipartFormDataStream nicht. Wo kann ich die downloaden?

MfG Dave

Björn Ole 6. Feb 2010 13:40

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Delphi-Quellcode:
uses IdMultiPartFormData
:wink:

Namenloser 6. Feb 2010 13:41

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Die sollte bei deiner Indy-Installation schon dabei sein. Du musst allerdings die Unit IdMultipartFormData einbinden.

DaveRidge 6. Feb 2010 13:46

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
indy hatte ich schon drauf, aber er findet
IdMultipartFormData.dcu nicht. Hat die jemand mal für mich?

mfg Dave

Namenloser 6. Feb 2010 13:54

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Die Unit liegt bei mir in <Indy-10-Verzeichnis>\Lib\Protocols\IdMultipartFormData.dcu . Hast du alle Bibliothekspfade unter Delphi richtig eingetragen?

DaveRidge 6. Feb 2010 14:09

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
mmh, kann es sein, weil ich indy6 druf hab?
Hab ja auch Delphi6. Ich werd Indy mal runterschmeißen und mal neu druff machen, mal schaun obs geht?

MfG Dave

Namenloser 6. Feb 2010 14:12

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Daran wird es wohl liegen. Du kannst es ja mal stattdessen mit der MsMultiPartFormData.pas probieren. Besser wäre es wahrscheinlich trotzdem, eine neue Indy-Version zu laden.

DaveRidge 6. Feb 2010 14:55

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
tja, jetzt ist das eingetreten was ich befürchtet hab.

Package C:\...... can`t be installed because it is not a design time package.

Hat einer einen Vorschlag?

Namenloser 6. Feb 2010 16:07

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Matze hat mal ein Tutorial dazu geschrieben, wie man die Indys installiert. Ich weiß zwar nicht, welche Delphiversion du hast, aber vielleicht hilft es dir ja.

DaveRidge 6. Feb 2010 16:38

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Zitat:

Zitat von NamenLozer
Matze hat mal ein Tutorial dazu geschrieben, wie man die Indys installiert. Ich weiß zwar nicht, welche Delphiversion du hast, aber vielleicht hilft es dir ja.

danke. Ich hol mir gleich vom Kumpel die 2009er version.
Delphi 6 hat bei mir sowie so schon ne macke :-)

Danke

Klaus01 6. Feb 2010 17:43

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Zitat:

Zitat von DaveRidge
Ich hol mir gleich vom Kumpel die 2009er version.

?????

DaveRidge 6. Feb 2010 17:47

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Zitat:

Zitat von Klaus01
Zitat:

Zitat von DaveRidge
Ich hol mir gleich vom Kumpel die 2009er version.

?????


Ja, Delphi 2009. Er hat sie sich gestern gekauft

Klaus01 6. Feb 2010 18:10

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Zitat:

Zitat von DaveRidge
Zitat:

Zitat von Klaus01
Zitat:

Zitat von DaveRidge
Ich hol mir gleich vom Kumpel die 2009er version.

?????


Ja, Delphi 2009. Er hat sie sich gestern gekauft

Ja, er hat sie sich gekauft.
Wenn das eine Version ist die jeder installieren darf, hätte ich sie auch gerne.

Grüße
Klaus

DaveRidge 6. Feb 2010 18:32

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Man kann sie sich installieren und dann testen. Ist dann eine Demo version.

Ich werd erstmal schau wie die ist. Ich brauch so oder so mal eine neue Version Delphi 6 ist ja schon etwas älter

MfG Dave

DaveRidge 6. Feb 2010 20:34

Re: TIdMultipartFormDataStream; Bild via post übertragen
 
Also ich hab mit Delphi2009 jetzt zwar die Postmethode hinbekommen, nur der Upload will noch nicht.
Der code:

Delphi-Quellcode:
var
//  stream: TIdMultipartFormDataStream;
  Input:TStringList;
  Output:TStringStream;
begin
  Input := TStringList.Create;
//if not OpenDialog1.Execute then Exit;
//ProgressBar1.Min := 0;
//  stream := TIdMultipartFormDataStream.Create;

  try
  Input.Values['user']:=Form1.Edit1.Text;
  Input.Values['passwort']:=Form1.Edit2.Text;
  Input.Values['Datei']:=; //Wie bekommw ich jetzt hier das Bild rein????
  Input.Values['mode1']:='p';
  Input.Values['mode2']:='1';
  Input.Values['mode3']:='f';
  Input.Values['schreiber']:='igge';
  Input.Values['usersbook']:='na du, wer sonst';
  Input.Values['text']:='MMh, maln Test';


//  stream1.AddFile('$bild_2=',OpenDialog1.FileName,'jpg');
  Memo1.Text:=IdHTTP1.Post('http://www.blablabl.de/php.php',Input);
finally
  stream.Free;
   end;
end;
Ist zwar ein bissel durcheinander, weil ich noch nicht weiss wie ich das ausführen soll.
Kann mir da einer helfen?


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:14 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz