Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['submit'])) {
- $file = $_FILES['file'];
- //print_r($file);
- $fileName = $_FILES['file']['name'];
- $fileTmpName = $_FILES['file']['tmp_name'];
- $fileType = $_FILES['file']['type'];
- $fileSize = $_FILES['file']['size'];
- $fileError = $_FILES['file']['error'];
- $fileExt = explode('.', $fileName);
- $fileActualExt = strtolower(end($fileExt));
- $allowed = array("jpg", "jpeg", "png");
- if (in_array($fileActualExt, $allowed)) {
- if ($fileError == 0) {
- if ($fileSize < 1000000) {
- $fileNameNew = uniqid('', true).".".$fileActualExt;
- $fileDestination = "/opt/lampp/htdocs/matrimony/upload/".$fileNameNew;
- if (move_uploaded_file($fileTmpName, $fileDestination)) {
- header("Location:img.php?success");
- } else {
- echo "something wrong";
- }
- } else {
- echo "your file is too big!";
- }
- } else {
- echo "There was error in uploading your file!";
- }
- } else {
- echo "you cannot upload this type of files!";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment