Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Indy HTTP.Post von Dateien ! (https://www.delphipraxis.net/12493-indy-http-post-von-dateien.html)

Schangu 28. Nov 2003 14:17


Indy HTTP.Post von Dateien !
 
Ich hab das Script soweit zum laufen das Daten rausgehen und auch bei beim script was es empfangen soll ankommen:

Code:
Delphi-Quellcode:
var
  datei: TSearchRec;
  a: integer;
  s: string;
  Sa : string;
  SL : TStringList;
  data: TIdMultiPartFormDataStream;
begin
  s := DirButton.Text + '/*.*' ;
  ListBox1.Clear;
  If FindFirst(s,faAnyFile,datei) = 0 then
  begin

    try
      repeat
      If datei.Name = '.' then Continue;
      If datei.Name = '..' then Continue;
      If datei.Name = 'Thumbs.db' then Continue;
      ListBox1.Items.Add(datei.name);
      data := TIdMultiPartFormDataStream.Create;
      data.AddFile('archive', DirButton.Text + '/' + datei.name, 'image/jpeg');
      data.Position := 0;
      Memo1.Text := IdHTTP1.Post('http://www.slz-s3.de/tests/post.php', data);
      data.Free;
      until Findnext(datei) <> 0;
  finally
    FindClose(datei);
  end;
  // ListBox1.Items.SaveToFile('./list.upl');

  SaveMsg.Visible := TRUE;
end;

Das Empfangsscript sieht so aus:
Code:
<?php

$uploadfile = "./files/" . $HTTP_POST_FILES['archive']['name'];
if (move_uploaded_file($HTTP_POST_FILES['archive']['tmp_name'], $uploadfile)) { 
    print "Upload compelete\n";
} else { 
    print_r($HTTP_POST_FILES);

?>


Nun das Problem: das PHP Script erhält zwar die Daten zugesendet kann sie aber nicht der Variable "archiv" zuordnen.
Das heisst $HTTP_POST_FILES gibt ein leeres Array aus. Weiss einer woran das liegen könnte?



UPDATE:
Habe das Problem schon näher herrausgefunden: Die Files werden nicht als Binary gesendet sondern als purer Text und deshalb werden sie vom Script auch nicht erkannt!

Schangu 28. Nov 2003 22:50

Re: Indy HTTP.Post von Dateien !
 
Weiß das einer?


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:03 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