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
April 13, 2016 at 4:31 pm
#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->loader->add_action('wp_ajax_cmr_upload', $plugin_admin, "cmr_upload");