Welcome Guest, Not a member yet? Register   Sign In
Multiple file flash upload vs error 406
#1

[eluser]Unknown[/eluser]
Hi Everybody!


I'm trying to integrate SWFUpload to my site, and all the time i get "Error: 406".

I've tried with Uploadify, but with the same effect... ;/

In IE 7 I'm also getting pop up titled "Adobe Flash Player 10" which says about Action script error "Error # 2044: Unsupported IOErrorEvent:. text = Error # 2038: Error to access a file."

I've changed mime types in my config files to accept "application/octet-stream" on images.

I know that it was many times before, but even after reading and implementing tons of your advices i'm still unable to make it work... ;/

About my code:
those methods are located in one class

method generating HTML page:
Code:
function manage_photos() {

    // checks if user is logged in
    if(!$this->auth->logged_in()) { redirect('admin'); }

    $this->load->view('admin/admin_header_view');

// here is part making $content of my page

    $this->load->view('admin/manage_photos_view', $content);

    $footer['scripts'] = '<scr_ipt type="text/javascript" src="' . base_url() . 'public/scripts/swfupload/swfupload.js"></scr_ipt>' . "\n";
    $footer['scripts'] .= '<scr_ipt type="text/javascript" src="' . base_url() . 'public/scripts/swfupload/swfupload.queue.js"></scr_ipt>' . "\n";
    $footer['scripts'] .= '<scr_ipt type="text/javascript" src="' . base_url() . 'public/scripts/swfupload/fileprogress.js"></scr_ipt>' . "\n";
    $footer['scripts'] .= '[removed]</scr_ipt>' . "\n";
    $footer['scripts'] .= '
    <scr_ipt type="text/javascript">
        var swfu;

        window.onload = function() {
            var settings = {
                flash_url: "' . base_url() . 'public/flash/swfupload.swf",
                upload_url: "' . base_url() . 'admin/panel/upload_photo/' . $gallery_url . '/' . $gallery_id . '.html",
                file_size_limit : "100 MB",
                file_types : "*.jpg",
                file_types_description : "Pliki JPG",
                file_upload_limit : 100,
                file_queue_limit : 0,
                custom_settings : {
                    progressTarget : "upload_queue",
                    cancelButtonId : "upload_cancel"
                },
                debug: true,

                // Button settings
                button_image_url: "images/TestImageNoText_65x29.png",
                button_width: "65",
                button_height: "29",
                button_placeholder_id: "uploader",
                button_text: \'<span class="theFont">Hello</span>\',
                button_text_style: ".theFont { font-size: 16; }",
                button_text_left_padding: 12,
                button_text_top_padding: 3,

                // The event handler functions are defined in handlers.js
                file_queued_handler : fileQueued,
                file_queue_error_handler : fileQueueError,
                file_dialog_complete_handler : fileDialogComplete,
                upload_start_handler : uploadStart,
                upload_progress_handler : uploadProgress,
                upload_error_handler : uploadError,
                upload_success_handler : uploadSuccess,
                upload_complete_handler : uploadComplete,
                queue_complete_handler : queueComplete    // Queue plugin event
            };

            swfu = new SWFUpload(settings);
        };
    </scr_ipt>';
    
    $this->load->view('admin/admin_footer_view', $footer);

} //manage_photos

method working with the upload:
Code:
function upload_photo() {

// basic configuration
    $config['upload_path'] = './public/images/galleries/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size']    = 2048;
    $config['encrypt_name'] = TRUE;

    $this->load->library('upload', $config);

// if photo upload fails...
    if( !$this->upload->do_upload('new_photo') ) {

        $content['error'] = $this->upload->display_errors();

        $this->load->view('admin/admin_header_view');
        $this->load->view('admin/test_view', $content);
        $this->load->view('admin/admin_footer_view');

// if photo upload succeeds...
    } else {

        $new_photo = $this->upload->data();
        $gallery_url = $this->uri->segment(4);
        $gallery_id = $this->uri->segment(5);

    // if adding new photo to database fails...
        if( !$this->admin_model->add_photo($gallery_id, $new_photo['file_name']) ) {

            $content['error'] = 'Błąd! Zdjęcie nie zostało dodane do bazy.';

            $this->load->view('admin/admin_header_view');
            $this->load->view('admin/test_view', $content);
            $this->load->view('admin/admin_footer_view');

    // if sdding new photo to database succeeds...
        } else {

        // when upload succeeds.
            echo($new_photo['full_path']);
//                    redirect('admin/panel/manage_photos/' . $gallery_url);

        }

    }

}

I don't know what should be returned after successful upload so as You can see i'm returning path to uploaded image (redirect() is used along with standard input file method, which works perfectly with this "upload_photo").

I don't know if this helps, but after adding in my .htaccess "SecFilterEngine Off" error 406 disappears, i have "Complete" message from SWFUploader, but still in SWF debug info i can read that CI throws error "You did not select a file to upload."




Theme © iAndrew 2016 - Forum software by © MyBB