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

前端 未结 4 1315
北恋
北恋 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:42

    if your goal is to upload an image and store it in a directory on the server then this code sample might help get you started (though I won't swear that it's bug free or secure). It's a single page form to upload, save, and display an image.

     $value){
            $image_tmp = $value['tmp_name'];
            $image = $value['name'];
            $image_file = "{$UPLOADDIR}{$image}";
    
            // move the file to the permanent location
            if(move_uploaded_file($image_tmp,$image_file)){
                echo <<
        file not found
    HEREDOC; } else{ echo "

    image file upload failed, image too big after compression

    "; } } } else{ ?>

提交回复
热议问题