Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(isset($_POST['submit'])) {
- $file = $_FILES['file'];
- $fileName = $_FILES['file']['name'];
- $fileTmpName = $_FILES['file']['tmp_name'];
- $fileSize = $_FILES['file']['size'];
- $fileError = $_FILES['file']['error'];
- $fileType = $_FILES['file']['type'];
- $fileExt = explode('.', $fileName);
- $fileActualExt = strtolower(end($fileExt));
- $allowed = array('jpg','jpeg','png','mov','mp4','mp3');
- if(in_array($fileActualExt, $allowed)) {
- if($fileError === 0) {
- if($fileSize < 2000000) {
- $fileNameNew = uniqid('', true).".".$fileActualExt;
- $fileDestination = 'uploadfile/'.$fileNameNew;
- move_uploaded_file($fileTmpName, $fileDestination);
- header("Location: fertig.php");
- }else{
- echo "Die Datei ist zu groß, maximal 2GB!";
- }
- }else{
- echo "Es ist ein Fehler aufgetreten, bitte lade die Seite neu und versuche es erneut!";
- }
- }else{
- echo "Dieser Datei Typ wird nicht unterschützt!";
- }
- }
Add Comment
Please, Sign In to add comment