Autor Beitrag
Lsm09
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Win 7, Win 8
Turbo Delphi, Delphi 5, Lazarus
BeitragVerfasst: Do 10.01.13 16:18 
Ich habe mit folgendem Code Versucht, eine Datei per PHP hochzuladen (FTP geht nicht):
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button2Click(Sender: TObject);
var
Data:TFileStream;
res:TStrings;
begin
   Data:=TFileStream.Create('1.txt', fmOpenRead);
  if httppostfile('127.0.0.1/upload/index.html''datei''1.txt',data,res)=true then showmessage('True')else showmessage('False');
end;


Das Kombilieren klappt, aber wenn ich den Button anklicke kommt folgender Fehler:
Projekt projekt1 hat Exception-Klasse >>External: SIGSEGV<< ausgelöst.

Bei Adresse 67DDE


Weiß jemand, woran es liegt?
(Ich nutze Lazarus)
Lsm09 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 38

Win XP, Win 7, Win 8
Turbo Delphi, Delphi 5, Lazarus
BeitragVerfasst: So 13.01.13 11:44 
Hab jetzt was funktionierendes gefunden (nehme dafür jetzt Turbo Delphi):

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
var
  data: TIdMultiPartFormDataStream;
   idhttp1: TIdHttp;
   plan1,plan2,plan3,plan4,plan5,plan6,plan7,plan8,feld1,feld2,feld3,feld4,feld5,feld6,feld7,feld8,upload:string;
begin
   idhttp1 := TIdhttp.Create(Self);
  data := TIdMultiPartFormDataStream.Create;
 if fileexists('filepaths.ini'then begin listbox1.items.loadfromfile('filepaths.ini');
 plan1:=listbox1.items[0];
 plan2:=listbox1.items[1];
 plan3:=listbox1.items[2];
 plan4:=listbox1.items[3];
 plan5:=listbox1.items[4];
 plan6:=listbox1.items[5];
 plan7:=listbox1.items[6];
 plan8:=listbox1.items[7];
 feld1:=listbox1.items[8];
 feld2:=listbox1.items[9];
 feld3:=listbox1.items[10];
 feld4:=listbox1.items[11];
 feld5:=listbox1.items[12];
 feld6:=listbox1.items[13];
 feld7:=listbox1.items[14];
 feld8:=listbox1.items[15];
 upload:=listbox1.items[16];
 listbox1.clear;
  end;
  data.AddFile(feld1,plan1,'text');
  data.AddFile(feld2,plan2,'text');
  data.AddFile(feld3,plan3,'text');
  data.AddFile(feld4,plan4,'text');
  data.AddFile(feld5,plan5,'text');
  data.AddFile(feld6,plan6,'text');
  data.AddFile(feld7,plan7,'text');
  data.AddFile(feld8,plan8,'text');

  idhttp1.Post(upload, data);
  data.free;

end;