Single input box uploads multiple file operations

Source: Internet
Author: User

HTML page:

1 <Divclass= "Form-group thumb">2                                         <labelclass= "Control-label col-xs-12 col-sm-3 no-padding-right" for= "Info">Product image upload:</label>3 4                                         <Divclass= "Col-xs-12 col-sm-9"style= "width:25%;">5 6                                             <Divclass= "Clearfix"><inputtype= "File"multiple= "true"name= "images[]"ID= "Id-input-file-2" /></Div>7 8                                         </Div>9                                     </Div>
Multiple= "true" name= "images[]"
These two are more important, that is, otherwise: 1, can not select more files. 2, upload the file $_files only one file.
Print out file type after uploading:


In this format, we must not be able to use thinkphp upload and Uploadone method to upload files.
1 Array2 (31=>Array(4([name]=>5[type]=>6([name]=>7[type]=>8([name]=>9[type]=>Ten                )           One2=>Array( A([name]=> -[type]=> -([name]=> the[type]=> -([name]=> -[type]=> -                )       + ) -     


So write yourself a way to deal with it.
1                     if(Array_sum($_files[' Images '] [' Size ']) >0){2                         $tmp=Array();3                         foreach($_files[' Images '] as $k=$v) {4                             foreach($v  as $kk=$VV) {5                                 $tmp[$kk][$k]=$VV;6                             }7                         }8                         $images=fab_upload ($tmp);9                         $input[' Images ']=Serialize($images);

After processing the equivalent of more than one input box inpuit box corresponding to an upload file to get the $_files data, and then will contain an upload information (upload file in the server's storage path) to serialize, into the text storage type of storage field, when the picture is displayed, Of course it's unserialize deserialization!

Single input box uploads multiple file operations

Related Article

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.