Einzelnen Beitrag anzeigen

Marc

Registriert seit: 23. Jul 2003
19 Beiträge
 
Delphi 7 Personal
 
#1

IdHttp Post + PHP funktioniert nicht

  Alt 15. Jul 2004, 19:08
Ich will mit hilfe der Post methode eine Text Datei hochladen:

Delphi Source:
Delphi-Quellcode:
procedure TForm1.sendfile(filename:string);
var
  data: TIdMultiPartFormDataStream;
begin
  data := TIdMultiPartFormDataStream.Create;
  try
    data.AddFile('userfile', filename, 'text/plain');
    data.Position := 0;
    Memo1.Lines.Text := IdHTTP1.Post('http://lalalala.de/upload.php', data);
  finally
    data.Free;
  end;
end;
PHP Source:

Code:
<?php
// In PHP kleiner als 4.1.0 sollten Sie $HTTP_POST_FILES anstatt $_FILES verwenden.
// In PHP kleiner als 4.0.3 verwenden Sie copy() und is_uploaded_file() anstatt von
// move_uploaded_file()

$uploaddir = '/daten/';

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
   print "File is valid, and was successfully uploaded. 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);
}

?>
allerdings erscheint, wenn ich die funktion aufrufe im Memo immer "Possible file upload attack...."

Woran kann das liegen?
  Mit Zitat antworten Zitat