ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Tap into filemanager

January 03, 2011 3:22pm

Subscribe [1]
  • #1 / Jan 03, 2011 3:22pm

    bryan2jumpstart

    98 posts

    I’m trying to develop an file upload field that utilizes swfupload. Now I could create my own upload scripts but I really would like to just highjack the filemanager one. There is already an ajax based file upload on the filemanager page but I can’t seem to find the right combination of variables to get swfupload to work with it. Does anyone know an easy way to tap into the upload file method of the file manager? Here is a little of my swfupload code, I keep getting a 302 error code from swfupload, which I think usually means there is a redirect happening.

    SWFUpload.onload = function () {
                        var settings = {
                            flash_url : "'.$this->_theme_url().'swfupload/swfupload.swf",
                            flash9_url : "'.$this->_theme_url().'swfupload/swfupload_fp9.swf",
                            upload_url: "index.php?S=' . $_GET['S'] . '&D=cp&C=content_files&ajax=true&directory;='.$this->settings['upload_location'].'&enc;_path=' . $this->CI->encrypt->encode(rawurlencode($server_path), $this->EE->session->sess_crypt_key) . '",
                            file_post_name : "userfile",
                            post_params: {
                                "S" : "' . $_GET['S'] . '",
                                "XID" : "' . XID_SECURE_HASH . '",
                                "upload_dir" : "'.$this->settings['upload_location'].'"
                            },
                            file_size_limit : "100 MB",
                            file_types : "*.*",
                            file_types_description : "All Files",
                            file_upload_limit : 100,
                            file_queue_limit : 0,
                            custom_settings : {
                                progressTarget : "fsUploadProgress",
                                cancelButtonId : "btnCancel"
                            },
                            debug: true,
                    
                            // Button Settings
                            button_image_url : "'.$this->_theme_url().'images/XPButtonUploadText_61x22.png",
                            button_placeholder_id : "spanButtonPlaceholder",
                            button_width: 61,
                            button_height: 22,
                    
                            // The event handler functions are defined in handlers.js
                            swfupload_preload_handler : swfUploadPreLoad,
                            swfupload_load_failed_handler : swfUploadLoadFailed,
                            swfupload_loaded_handler : swfUploadLoaded,
                            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);
                    }';
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases