Autor Beitrag
Borlox
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Do 30.09.04 21:01 
Hi Leute,

ich möchte mit meinem Delphi Programm eine Datei per POST an ein PHP Script übergeben, so das ich die Datei mit PHP weiter verarbeiten kann, wie kann ich das machen???

Ich weiß nicht, wie ich das übergeben soll! Habe ja nur den Pfad und den Dateiname!

Meine bisherigen POST Anweisungen mache ich so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.ButtonClick(Sender: TObject); 
var sl : TStringlist; 
begin 
  sl := TStringList.Create; 
  sl.Add('Username='+edit1.text); 
  sl.Add('Passwort='+edit2.Text); 
  Memo1.Text := idHttp1.Post('http://www.meinepage.de/return.php',sl); 
  FreeAndNil(sl); 
end;


THX
Borlox
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 01.10.04 13:47 
hier mal eine funktion die ich mir gebastelt hab. such dir einfach mal faus, was du brauchst:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
procedure UploadFile(Filename: string);
var
  Stream: TIdMultiPartFormDataStream;
  StringStream: TStringStream;   
begin
     Stream := TIdMultiPartFormDataStream.Create;
     StringStream := TStringStream.Create('');
     try
        try
           Stream.AddFile('file',Filename, '');
           form1.IdHTTP1.Post(uploadURL, Stream, StringStream);
           //  uploadform.Memo1.lines.add ('Serverantwort: '+StringStream.DataString);
           uploadform.Memo1.lines.add ('Datei erfolgreich übertragen');
        except
              uploadform.Memo1.lines.add ('FEHLER beim Übertragen');
        end;
     finally
            Stream.Free;
            StringStream.Free;
     end;
end;

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Fr 01.10.04 22:17 
Titel: Post
^Hi,

sag mal habe gerade mal mein Code, den ich für Post benutze selber ausprobiert! Aber ich bekomme es einfach nicht hin! Es kommt immer diese Fehlermeldung:

[Error] UStat.pas(44): There is no overloaded version of 'Post' that can be called with these arguments


Ne Idee? Keine Ahnung, was das heißt? Ob dein Code funktioniert konnte ich deshalb noch nicht teste! War eigentlich davon ausgegangen, dass meiner Funktioniert!! Aber es geht einfach nicht!

THX
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 02.10.04 09:38 
hast du auch die variable uploadurl mit einer sinnvolle url gefüllt und die unit idMultiPartFormDataStream in uses aufgenommen ?

_________________
In the beginning was the word.
And the word was content-type: text/plain.
KidPaddle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 351

WinXP,Linux
D7 Prof, XE7
BeitragVerfasst: Sa 02.10.04 09:57 
Hat jemand auch ein Beispiel, wie man an die php.exe direkt POST - Daten übergeben kann, z. B. bei Verwendung ShellExecute. Ich habe einige Beispiele gefunden, die aber mit der php.exe nicht funktionieren, da wohl einige Daten nicht gesetzt werden.

Gruß
KidPaddle
Borlox Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 191

Win XP
Delphi 6 Enterprise
BeitragVerfasst: Sa 02.10.04 10:51 
Titel: Fehler
Nein, Matze du hast mich falsch verstanden! Es geht nicht um den Code von dir, sondern noch um meinen Code, den ich gepostet habe! Da kommt der Fehler! Zu deinem bin ich ja noch nicht gekommen!

THX


Habe gerade mal versucht die idMultiPartFormDataStream unter Uses einzubinden, aber er sagt mir, das mir die dazu gehörige DCU-Datei fehlt!
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 02.10.04 15:55 
kann es sein, dass du die indys nicht korrekt installiert hast ? oder haste ne alte version?

_________________
In the beginning was the word.
And the word was content-type: text/plain.