Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?php
- if(isset($_POST['submit'])){
- $file = $_FILES['image'];
- echo "<pre>";
- print_r($file);
- echo "</pre>";
- $fileName = $_FILES['file']['name'];
- $fileTmpName = $_FILES['file']['Tmp_name'];
- $fileError = $_FILES['file']['error'];
- $fileSize = $_FILES['file']['size'];
- $fileType = $_FILES['file']['type'];
- $fileExt = explode('.', $fileName);
- $fileActualExt = strtolower(end($fileExt));
- $allowed = array('jpg','jpeg','png','pdf');
- if (in_array($fileActualExt, $allowed)) {
- if ($fileError == 0) {
- if ($fileSize < 100000) {
- $fileNameNew = uniqid('',true).".".$fileActualExt;
- $fileDestionation = "../image/IMG".$fileNameNew;
- move_uploaded_file($fileTmpName, $fileDestionation);
- echo "succes";
- } else {
- echo "Plik jest za duży!";
- }
- } else {
- echo "Nie udało się przesłać pliku";
- }
- }else {
- echo "Nie udało się wysłać pilku tego typu.";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement