% EF % BB % BF appears in the URL during uploadify batch upload.

Source: Internet
Author: User

I found a solution to my problem. Then I went to Google and found a method for foreigners.

Run the Code directly.

JS:

 1 <script type="text/javascript"> 2 $(document).ready(function() { 3    $(‘#file_upload‘).uploadify({ 4      ‘height‘    : 30, 5      ‘width‘     : 100, 6      ‘buttonImg‘ : ‘<?=base_url()?>style/images/buttons/button_dodaj_gray.png‘, 7      ‘cancelImg‘ : ‘<?=base_url()?>style/js/uploadify/cancel.png‘, 8      ‘wmode‘     : ‘transparent‘, 9      ‘onComplete‘: function(event, ID, fileObj, response, data) {10           if( response != "ERROR" )11           {12               var imageSrc = "";13               //imageSrc = "/ads_images_temp/";14               imageSrc = response;15               $(‘.image_container‘).html(‘‘+imageSrc+‘"></img>‘);16           }17      },18      ‘fileExt‘   : ‘*.jpg;*.jpeg;*.png;*.gif‘,19      ‘displayData‘: ‘percentage‘,20      ‘multi‘     : false,21      ‘uploader‘  : ‘<?=base_url()?>style/js/uploadify/uploadify.swf‘,22      ‘script‘    : ‘/tools/upload/product/glavna‘,23 24      ‘auto‘      : true25    });26 });27 </script>

PHP:

if ( !empty($_FILES) )            {                $config[‘upload_path‘] = $temp_path;                $config[‘allowed_types‘] = ‘*‘;                $config[‘max_size‘] = 4000;                $config[‘encrypt_name‘] = true;                $this->load->library(‘upload‘, $config);                $this->upload->initialize($config);                if( ! ($this->upload->do_upload("Filedata")))                 {                    //echo $this->upload->display_errors(‘<p>‘, ‘</p>‘);                    echo "ERROR";                }                else                 {                    $img = $this->upload->data();                    if($img[‘image_width‘] > 650)                    {                        $config[‘image_library‘] = ‘gd2‘;                        $config[‘source_image‘] = $img[‘full_path‘];                        $config[‘create_thumb‘] = TRUE;                        $config[‘maintain_ratio‘] = TRUE;                        $config[‘width‘] = 650;                        $this->load->library(‘image_lib‘, $config);                        $this->image_lib->resize();                    }                    // Resize image                        $this->Product_model->resize_image($img[‘full_path‘], $temp_path.‘/crop_‘.$img["raw_name"].$img["file_ext"], 160, 120);                    $this->Product_model->resize_image($img[‘full_path‘], $temp_path.‘/crop_crop_‘.$img["raw_name"].$img["file_ext"], 80, 60);                    $imeSlike = $img["raw_name"].$img["file_ext"];                    echo $imeSlike;                }            }

The running result is: the file is saved with the name 768f32dd43cc1f90b79c83cceed57eb2.png. The URL obtained is: descrief?bb=bf768f32dd43cc1f90b79c83cceed57eb2.png.

% EF % BB % BF is not explained. The solution is described above.

PHP:

1  $json = array("name" => $imeSlike, "error" => 0);2     echo json_encode($json);

JS:

1 ‘onComplete‘: function(event, ID, fileObj, response, data) {2         eval("var obj1="+response);3 4         if( obj1.error == 0 )5         {6             $(‘.image_container‘).html(‘ads_images_temp/crop_‘+obj1.name+‘"></img>‘);7         }8      }

 

% EF % BB % BF appears in the URL during uploadify batch upload.

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.