This is only a multi-image upload modification operation, multi-image upload operation is similar to this, try to come just
Operation of 1.html
1 <TD>2 3 <ulID= "Photos"class= "Pic-list list-unstyled form-inline">4 <Notemptyname= "Tags.describe_pic">5 <foreachname= "tags[' describe_pic ')"Item= "Vo">6 <PHP>$img _url=cmf_get_image_preview_url ($VO);</PHP>7 <LiID= "saved-image{$key}">8 <inputID= "photo-{$key}"type= "hidden"name= "describe_pic[]"9 value= "{$vo}">//Hide the inputTen <inputDisabled= "Disabled"type= "hidden"class= "Form-control"ID= "photo-{$key}-name"type= "text" One name= "photo_names[]" A value= "{$vo |default= '}"style= "width:200px;"title= "Picture name">//Hide the input - <imgID= "photo-{$key}-preview" - src= "{: Cmf_get_image_preview_url ($VO)}" the style= "HEIGHT:36PX;WIDTH:36PX;" - onclick= "Parent.imagepreviewdialog (THIS.SRC);"> - <ahref= "Javascript:uploadoneimage (' image upload ', ' #photo-{$key} ');">Replace</a> - <ahref= "javascript: (function () {$ (' #saved-image{$key} '). Remove ();}) ();">Removed from</a> + </Li> - </foreach> + </Notempty> A </ul> at <ahref= "Javascript:uploadmultiimage (' image upload ', ' #photos ', ' photos-item-tpl ');" - class= "btn btn-sm btn-default">Select picture</a> - </TD>
Operation of 2.js
1<style type= "Text/css" >2. pic-list Li {3margin-bottom:5px;4 }5</style>6<script type= "text/html" id= "PHOTOS-ITEM-TPL" >7<li id= "Saved-image{id}" >8<input id= "Photo-{id}" type= "hidden" name= "describe_pic[" "value=" {filepath} ">9Tenonclick= "Imagepreviewdialog (THIS.SRC);" > One<a href= "javascript:uploadoneimage (' image upload ', ' #photo-{id} ');" > Replace </a> A<a href= "javascript: (function () {$ (' #saved-image{id} '). Remove ();}) ();" > Removal </a> -</li> -</script>
3. Receiver operation of the controller
1 $intId=$this->request->param ("id", 0, ' intval ');2 $data=$this->request->param (); 3 if(Empty($data[' Describe_pic '])){4 $list=db::name (' style '))5->where (' id ',$intId)6-find ();7 $data[' describe_pic '] =$list[' Describe_pic '];8}Else{9 $data[' describe_pic '] =Serialize($data[' Describe_pic ']);Ten } OneDb::name (' style ')) A->where (' id ',$intId) -->update ($data); - $this->success ("Saved successfully! ", url (" Adminstyle/index "));
4. The operation is complete.
About modifying a multi-image upload