-
-
Save undone37/52e2dbae7b6f01226e24f349c75d5cf8 to your computer and use it in GitHub Desktop.
Einfacher PHP Datei Upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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