Use plupload to upload images and save them to custom folder and database table

I managed to do it by myself thanks to this tutorial. Moved content of do.php file to a function named cmr_upload inside a class. Then changed the plupload options from: url : plugin_dir + ‘do.php’, … multipart_params : { “chapter_id”: i, “path”: path to url : ‘<?php echo admin_url(‘admin-ajax.php’) ?>’, … multipart_params : { “chapter_id”: … Read more

How to delete file uploaded by Plupload

To delete a file from the file system, you can use something like this attached to an AJAX hook that is called by jQuery: function ajax_remove_image() { check_ajax_referer( ‘image_removal’, ‘image_removal_nonce’ ); if ( ! $_POST[ ‘confirm’ ] ) exit( ‘false’ ); $uploads = wp_upload_dir(); $upload_dir = $uploads[ ‘path’ ]; $file = strpos( $_POST[ ‘file’ ], … Read more