Welcome Guest, Not a member yet? Register   Sign In
swfupload
#1

[eluser]tirso[/eluser]
hi to all

I hope someone could help me to solve this.

I am using swfupload for multiple uploading. I searched first how to integrate swfupload in ci. My problem is during the uploading there is error message.

thanks in advance

my directory structure

css/default.css
swfupload/swfupload.js
/swfupload.swf
/swfuploadbutton.swf
js_swfupload/fileprogress.js
/swfupload.queue.js
/handlers.js



I already change application/config/mimes.php

Code:
'jpeg'  =>  array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'jpg'   =>  array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'jpe'   =>  array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),
'png'   =>  array('image/png',  'image/x-png', 'application/octet-stream')


my view

Code:
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <title>Upload Test</title>
    <link href="<?=base_url();?>css/default.css" rel="stylesheet" type="text/css" />
    [removed][removed]
    [removed][removed]
    [removed][removed]
    [removed][removed]
</head>
<body>

[removed]

        var swfu;

        window.onload = function() {
            var settings = {
                
                flash_url : "<?=base_url();?>swfupload/swfupload.swf",
                //points the our codeigniter method
                upload_url: "<?=site_url()?>/fileupload/upload",
                //make sure to pass our session id (assuming there is a logged in user)
                post_params: {"PHPSESSID" : "<?=$this->session->userdata('session_id')?>"},
                file_size_limit : "10 MB",
                file_types : "*.jpg",
                file_types_description : "Images",
                file_upload_limit : 100,
                file_queue_limit : 0,
                custom_settings : {
                    progressTarget : "fsUploadProgress",
                    cancelButtonId : "btnCancel"
                },
                debug: true,
                
                // 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);
         };
[removed]
<form id="form1" action="" method="post" enctype="multipart/form-data">
    
    <div class="fieldset flash" id="fsUploadProgress">
        <span class="legend">Upload Queue</span>
    </div>
    <div id="divStatus">0 Files Uploaded</div>
    <div>    
         &lt;input type="button" value="Select Files"&gt;
         &lt;input id="btnCancel" type="button" value="Cancel All Uploads"&gt;
    </div>
&lt;/form&gt;


my controller

Code:
class Fileupload extends Controller {

    function Fileupload()
    {
        parent::Controller();
        $this->load->helper(array('form', 'url'));    
        $this->load->library('session');        
    }

    function index(){
        $this->load->view('upload');
    }

    function upload(){
       //you should have swfuploader POST your session id (youll see in the view)
       $params['session_id'] = $this->input->post("PHPSESSID");
       //load the session library the new way, by passing it the session id
       $this->load->library('session', $params);

       if ($this->session->userdata('logged_in') != true) show_404(); //cancel if the user is not logged in

        $user_id = $this->session->userdata('user_id');

        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|png';        
        $config['max_size']    = '100';
        $config['max_width']  = '1024';
        $config['max_height']  = '768';
        
        $this->load->library('upload', $config);
        
        if ( ! $this->upload->do_upload('Filedata')){
             //upload failed, do stuff
             show_404(); //maybe? you can handle it how you want with swfuploader
        } else {
             //insert stuff to a database.
        }
    }
}


here is the debug result (this debug result is only the lower portion since I have no characters remaining left.
SWF DEBUG: StartUpload: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: Global Post Item: PHPSESSID=2f1b3f61a50dbf0ae24333f8d3133103
SWF DEBUG: ReturnUploadStart(): File accepted by startUpload event and readied for upload. Starting upload to http://localhost/shinheung_codeigniter/i...oad/upload for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress (OPEN): File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 6843. Total: 6843
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 404.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.
Error Code: HTTP Error, File name: 77.jpg, Message: 404


Messages In This Thread
swfupload - by El Forum - 08-27-2009, 08:23 AM
swfupload - by El Forum - 08-27-2009, 04:48 PM
swfupload - by El Forum - 08-27-2009, 07:57 PM
swfupload - by El Forum - 09-04-2009, 09:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB