philippgerard: Datei hochladen

Beitrag lesen

Hallo,

man sehe sich http://www.php.net/manual/de/function.copy.php an und lese:

---------------------------------------------------------------------

<HTML>
<TITLE>
File upload
</title>
<body>

<B>File upload</b>

<form enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>" method="post">

<!-- "MAX_FILE_SIZE" determines the biggest size an uploaded file can occupy -->

<input type="hidden" name="MAX_FILE_SIZE" value="500000">
Send this file:
 <input name="userfile" type="file">
<input type="submit" name="submit" value="Send File">
</form>

</body>

<?PHP

/*

$userfile - The temporary filename in which the uploaded file was stored on the server machine.

$userfile_name - The original name or path of the file on the sender's system.

$userfile_size - The size of the uploaded file in bytes.

$userfile_type - The mime type of the file if the browser provided this information. An example would be "image/gif".

*/

// copy to this directory

$dir="./bor/";

// copy the file to the server

if (isset($submit)){

copy($userfile,$dir.$userfile_name);

if (!is_uploaded_file ($userfile)){

echo "
<b>$userfile_name</b> couldn't be copied !!";
}
}

// check whether it has been uploaded

if (is_uploaded_file ($userfile)){

echo "
<b>$userfile_name</b> copied succesfully !!";

}

?>

</html>

---------------------------------------------------------------------

Viel Erfolg!