Skip to content

Instantly share code, notes, and snippets.

@undone37
Forked from taterbase/upload.php
Last active November 7, 2018 12:26
Show Gist options
  • Save undone37/52e2dbae7b6f01226e24f349c75d5cf8 to your computer and use it in GitHub Desktop.
Save undone37/52e2dbae7b6f01226e24f349c75d5cf8 to your computer and use it in GitHub Desktop.
Einfacher PHP Datei Upload
<!DOCTYPE html>
<html>
<head>
<title>Dateiupload</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Laden Sie eine Datei hoch</p>
<input type="file" name="file"><br />
<input type="submit" value="Upload">
</form>
<?php
if(!empty($_FILES['file']))
{
$path = "dstfolder/";
$path = $path . basename( $_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $path)) {
echo "Die Datei ". basename( $_FILES['file']['name']).
" wurde erfolgreich hochgeladen.";
} else{
echo "<b>Es trat ein Fehler beim Upload der Datei auf. Bitte versuchen Sie es erneut oder kontaktieren Sie den Administrator.</b>";
}
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment