0
Array (
    [name] => IMG_20191007_144704[1].jpg
    [type] => [tmp_name] => [error] => 1 [size] => 0
)

I dont know why is it happening please help me.. A very big thanks..

<?php  
    $errormsg = $successmsg =  ""; 
    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',);

        if(in_array($fileactualext, $allowed)) {
            if($fileerror === 0) {
                if($filesize < 1000000) {
                    $filenamenew = uniqid('', true).".".$fileactualext;
                    $filedestination = 'upload/'.$filenamenew;
                    move_uploaded_file($filetmpname, $filedestination);                    
                    echo  "Upload success!";
                } else {

                    echo "File is too big";
                }
            } else {
                echo "There is an error uploading the file";
            }
        } else {
            echo "You cannot upload files of this type";
        }
    } 
?>
Tushar Walzade
  • 3,737
  • 4
  • 33
  • 56
jhon
  • 11

0 Answers0