• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to integrate SWF Upload ?


I'm writing an application on which users can upload large files on a remote FTP server. To do that, I want use the SWFUpload plugin, but I don't know how I can integrate it in my application.

In fact, I don't know how I can call My do_upload() function in my Controller which is supposed to do the upload of the selected files on the ftp.

I post below my code :

In my header, I load the javascripts function like this :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
&lt;html &gt;
        &lt;title&gt;&lt;?php echo $title; ?&gt;&lt;/title&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
        &lt;?php echo link_tag('public/design.css', 'stylesheet', 'text/css', 'Design', 'screen'); ?&gt;
            var swfu;
            window.onload = function () {
                swfu = new SWFUpload({
                    //upload_url : "&lt;?php echo site_url();?&gt;/application/upload/do_upload",                
                    flash_url : "&lt;?php echo base_url();?&gt;public/js/FlashDevelop/Flash9/swfupload_f9.swf",    
                    post_params : {"PHPSESSID": "&lt;?=$this->session->userdata('session_id');?&gt;"},
                    file_types : "*.*",
                    file_types_description : "Tous les types",
                    file_size_limit : "2 GB",
                    file_upload_limit : 100,
                    //Event Handlers
                // 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
                    custom_settings : {
                        progressTarget : "fsUploadProgress",
                        cancelButtonId : "btnCancel"
                    debug : true

In addition, what code should write in my handlers to start the upload on my FTP. In fact, the thing I want to do is to call the do_upload() function (in my controller) on which I create the path on the FTP where the file has to be uploaded.

In my controller, I have the code below :
public function do_upload()
        echo 'here';

It's just an example, but I've the impression that this code is never called because the echo is never shown on my screen.

In my handlers, I just wrote the same code that the handlers which are on the SWF SimpleUpload Demos (on the SWF Upload website).

Can anybody help me ?

Another question : how can I upload large files on my ftp server without changing the php.ini max_size parameter ? (if I cannot use the SWF Upload plugin)


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.