This time to bring you bootstrap+php to achieve a multi-map upload steps in detail, bootstrap+php to realize the multi-image upload notes, the following is the actual case, together to see.
Use bootstrap interface beautiful, can preview, can drag upload, can cooperate with Ajax asynchronous or synchronous upload, the following is:
Front-end Code: fileinput.html
<! DOCTYPE html><!--release v4.1.8, copyright 2014-2015 Kartik visweswaran-->
Background code:
/* * BOOTST Multi-image upload */Public Function fileinput () { return $this->fetch (),} public function uploadimg () { //Var_ Dump ($_files); Get form upload file $file = Request ()->file (' images '); Move to the Framework app root directory under the/public/uploads/img directory $info = $file->move (root_path. ' Public '. Ds. ' uploads/img '); if ($info) { //successfully upload after uploading information $data [' response '] = $info->getsavename (); Return JSON ($DATA); Image upload successful, the following can be used for database operation //... } else{ //upload failed to get error message echo $file->geterror ();} }
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
Php+session prevent form Repeat submission steps
PHP Cache Tool XCache Installation and use case resolution