Welcome Guest, Not a member yet? Register   Sign In
Image upload error:The filetype you are attempting to upload is not allowed
#1

[eluser]Unknown[/eluser]
Code:
function form()
    {
        echo '<form action="/ci/upload/do_upload" enctype="multipart/form-data" method="post">
                <input name="file" type="file">
                <button type="submit">Submit</button>
             &lt;/form&gt;';
    }
    
    function do_upload()
    {
        
        $config['upload_path']   = $this->_file_path;
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '100';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';

        $this->load->library('upload', $config);
        
        print_r($_FILES);
        
        if ( ! $this->upload->do_upload('file'))
        {
            print_r($this->upload->data());
            $error = $this->upload->display_errors();
            
            $this->common->ajax_callback('fail', '' . $error);
        }
        
        // @todo Image resize
        $data = $this->upload->data();
        
        $this->common->ajax_callback('success', '');
    }

Code:
Array
(
    [file] => Array
        (
            [name] => p3.jpg
            [type] => image/jpeg
            [tmp_name] => E:\xampp\tmp\php41E.tmp
            [error] => 0
            [size] => 135027
        )

)
Array
(
    [file_name] => p3.jpg
    [file_type] =>
    [file_path] => E:/web/ci/file/update/
    [full_path] => E:/web/ci/file/update/p3.jpg
    [raw_name] => p3
    [orig_name] =>
    [client_name] => p3.jpg
    [file_ext] => .jpg
    [file_size] => 135027
    [is_image] =>
    [image_width] =>
    [image_height] =>
    [image_type] =>
    [image_size_str] =>
)
{"status":"fail","message":"\u4e0a\u50b3\u5931\u6557<br \/><p>The filetype you are attempting to upload is not allowed.<\/p>"}
#2

[eluser]ghprod[/eluser]
[quote author="atans" date="1325214112"]Resolved

xamppp php 5.2.9 php_mime_magic.dll not working
disable php_mime_magic.dll will be working[/quote]

Its works for me ... thanks a lot Smile




Theme © iAndrew 2016 - Forum software by © MyBB