title image


Smiley Dateiupload geht nicht
Moin,



ich habe mir unten stehendes Script von einer Free-Php Seite gezogen, aber es funktioniert nicht.

Ich bin nur leider nicht fit genug um den Fehler zu finden, noch um so ein Upload selber zu basteln.



Der Fehler ist, dass keine Datei in dem Zielverzeichnis auftaucht.

Der Pfad ist richtig angegeben und das VZ ist mit 777 chomoded.



Jemand eine Idee?

Hier das Script






// Simple upload interface in PHP.

// Please send your comments to web.master@male.ru

// 07.11.2001





$UPLOAD_PATH = "/srv/www/htdocs/php/upload/uploads/"; // directory on the server where are you going to upload files

// on Unix servers directories look like "/home/users/jack/files/"

// Don't forget about final slashes!!!



$UPLOAD_NUM = 5; // the number of upload fields

// display uploaded file list or errors during uploading

// and upload files

function displayUploadedList ()

{

global $UPLOAD_PATH,

$UPLOAD_NUM,

$HTTP_POST_FILES;



$buff = '';

$error = 0;

for ($i = 0; $i < $UPLOAD_NUM; $i++)

{

$name = $HTTP_POST_FILES["File$i"]['name']; // this is the real name of your file

$tmp = $HTTP_POST_FILES["File$i"]['tmp_name']; // this is the temporary name of your file in temporary

// directory on the server



if (!is_uploaded_file ($tmp)) // is this temporary file really uploaded?

continue;



$buff .= "".$name."";



if (!@move_uploaded_file($tmp, $UPLOAD_PATH."/".$name)) // move temporary file to your upload directory

$error = 1;

}



if (strlen ($buff) == 0)

{

?>

Select at least one file to upload.


return false;

}

else if ($error)

{

?>

Some of selected files have not been uploaded.

Check existence of upload directory: and your permissions.




return false;

}



?>

The following files have been uploaded






return true;

}



// display upload form

// this is not interesting function ;-(

function displayUploadForm () // display upload form,

{

global $UPLOAD_NUM;



$tablePre = "











Upload form









";



$displayed = '';

for ($i = 0; $i < $UPLOAD_NUM; $i++)

{

$displayed .= "";

}



$tableSuf = "









";



print $tablePre.$displayed.$tableSuf;

}

?>







Upload interface



















 




print "file upload";

?>







 




displayUploadForm ();

?>








if (isset ($Upload)) // if user has clicked on Upload button we must try to upload something

displayUploadedList ();

?>









Comments to: web.master@male.ru













geschrieben von

Login

E-Mail:
  

Passwort:
  

Beitrag anfügen

Symbol:
 
 
 
 
 
 
 
 
 
 
 
 
 

Überschrift: