How to display or preview a uploaded image after submitted in PHP without save to database?

前端 未结 4 1310
北恋
北恋 2021-01-19 07:07

There are actually 2 page involve in my project.The 1st page is a form that to submit the uploaded image into 2nd page based on action=\"2page.php\" and will di

4条回答
  •  清酒与你
    2021-01-19 07:38

    you can try this..here first u can upload a file and then take two divs in html one is for the upload button and another one is for the picture which you wana show... you can give background color for better clarity and understanding..

         30))
    {
    
    
    ##############################File Renaming ###################################################
    
    $newname=uniqid();
    //$ext=end(explode('.',$name));
    $fullname=$newname.".".$ext;
    $target="pics/";
    $fulltarget=$target.$fullname;
    if(move_uploaded_file($_FILES['img']['tmp_name'],$fulltarget))
    {
        echo "Success";
    
    
    
    }
    else
    {
        echo "Failed";
    }
    ##############################File Renaming end ###################################################
    }
    
    else{
        echo "not successful";
        }
    }
    ?>
    
    
    
    
    
    Untitled Document
    
    
    
    

    ";?>

提交回复
热议问题