Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Indy Datei upload (https://www.delphipraxis.net/61063-indy-datei-upload.html)

Kidix 16. Jan 2006 16:57


Indy Datei upload
 
Hallo,

bei den Indy Demos habe ich folgenden codeschnippsel für den Upload einer Datei gefunden:

Delphi-Quellcode:
begin
          Response := TStringStream.Create('');
          try
            if not bPostFile then
              HTTP.Post(cbURL.Text, mePostData.Lines, Response)
            else
            begin
              Source := TMemoryStream.Create;
              try
                Source.LoadFromFile(edPostFile.Text);
                HTTP.Post(cbURL.Text, Source, Response);
              finally
                Source.Free;
              end;
            end;
            memoHTML.Lines.Text := Response.DataString;
          finally
            Response.Free;
          end;
        end;
    end;
  finally
    Screen.Cursor := crDefault;
    btnStop.Enabled := False;
    btnGo.Enabled := True;
  end;
alles schön und gut, doch ich muss doch bei php eine namenszuweisung für ne datei haben...mit welchem Namen wird die Datei aber an das Script gesendet?

Hier mal der PHP Code

Code:
$uploaddir = 'files/';
$uploadfile = $uploaddir. $_FILES['archive']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['archive']['tmp_name'], $uploadfile)) { 
    print "File is valid, and was successfully uploaded. ";
    print "Here's some more debugging info:\n";
    print_r($_FILES);
} else { 
    print "Possible file upload attack!  Here's some debugging info:\n";
    print_r($_FILES);
}


$_FILES['archive']['name'] ist ja die namenszuweisung also archive...diese kann ich aber bei delphi nicht übergeben...oder gibts da nen standard für?

Kidix 20. Jan 2006 07:05

Re: Indy Datei upload
 
niemand ne idee?

Kidix 23. Jan 2006 15:13

Re: Indy Datei upload
 
push


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

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