PHP upload multi-image instant display and immediate deletion method

Source: Internet
Author: User
This article mainly introduces the PHP implementation of the upload multi-image real-time display and instant deletion method, combined with the example of PHP for image file preview, upload and delete related operations skills, need to refer to friends

This article describes the PHP implementation of upload multi-image display and instant deletion method. Share to everyone for your reference, as follows:

Like this, each selection of a picture will be displayed immediately, attached to the right, you can also delete an element.

In fact, when the Type=file input box onchange event = = = "Post data is submitted to the hidden Ifram (the target designation of form form) = = = =" "Receives the direct echo of the post data Script tag to return data to the front page and assign values, and then store the picture path is also implemented with hidden fields:

Html:

<!doctype html>

Controller (Returns the path to the selected picture (already uploaded) in the server):

Public Function submitimg () {    if (is_post) {        $data = I (' post.data ');//Get POST data        $res = Fab_upload ($_files); /upload file        $uid =uniqid ();        $res = $res [' thumb '];        if ($res) {          echo "<script>parent.callblack_img (' {$res} ', ' {$uid} ');</script>";        }}     }

A function that really finally receives the form data and stores it in the database:

Public Function add_journal () {     if (is_post) {         var_dump ($_post);d ie;       } else{        $this->display ();     }}

Related recommendations:

JavaScript-Mobile WAP station h5 upload multi-image feature in the UC browser can not choose more pictures, how to solve?

Mobile WAP station h5 upload multi-image feature in the UC browser can not choose more pictures, how to solve?

jquery-php upload multiple images after each picture is described and saved to MySQL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.