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