Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Upload images and save them to custom folder and database table with plupload Reply To: Upload images and save them to custom folder and database table with plupload

#240531
fbg
Participant

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": i,
                "path": path,
                "action": "cmr_upload"

Then added the function to an ajax action:

$this-&gt;loader-&gt;add_action('wp_ajax_cmr_upload', $plugin_admin, "cmr_upload");