Using with WPDM
-
I am trying this plugin to work with WordPress Download Manager. Here some code from WPDM about plupload. What modification we need to make it work?
$plupload_init = array( 'runtimes' => 'html5,silverlight,flash,html4', 'browse_button' => 'plupload-browse-button', 'container' => 'plupload-upload-ui', 'drop_element' => 'drag-drop-area', 'file_data_name' => 'package_file', 'multiple_queues' => true, 'max_file_size' => wp_max_upload_size().'b', 'url' => admin_url('admin-ajax.php'), 'flash_swf_url' => includes_url('js/plupload/plupload.flash.swf'), 'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'), 'filters' => array(array('title' => __('Allowed Files'), 'extensions' => '*')), 'multipart' => true, 'urlstream_upload' => true, // additional post data to send to our ajax hook 'multipart_params' => array( '_ajax_nonce' => wp_create_nonce('wpdm_admin_upload_file'), //'action' => 'wpdm_admin_upload_file', // the ajax action name 'action' => 'tux_big_file_uploads', // the ajax action name ), ); $plupload_init = apply_filters('plupload_init', $plupload_init); ?> function uploadFile(){ check_ajax_referer('wpdm_admin_upload_file'); if(!current_user_can('upload_files')) die('-2'); $ext = explode('.', $_FILES['package_file']['name']); $ext = end($ext); $ext = strtolower($ext); if(in_array($ext, array('php', 'js', 'html', 'py', 'pl', 'htaccess'))) die('-3'); if(file_exists(UPLOAD_DIR.$_FILES['package_file']['name']) && get_option('__wpdm_overwrrite_file',0)==1){ @unlink(UPLOAD_DIR.$_FILES['package_file']['name']); } if(file_exists(UPLOAD_DIR.$_FILES['package_file']['name'])) $filename = time().'wpdm_'.$_FILES['package_file']['name']; else $filename = $_FILES['package_file']['name']; do_action("wpdm_before_upload_file", $_FILES['package_file']); if(get_option('__wpdm_sanitize_filename', 0) == 1) $filename = sanitize_file_name($filename); move_uploaded_file($_FILES['package_file']['tmp_name'],UPLOAD_DIR.$filename); $filename = apply_filters("wpdm_after_upload_file", $filename); echo "|||".$filename."|||"; exit; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Using with WPDM’ is closed to new replies.