Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9316699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:41:20+00:00 2026-06-19T02:41:20+00:00

I’m trying to create a gallery plugin for WordPress and I’m using Plupload to

  • 0

I’m trying to create a gallery plugin for WordPress and I’m using Plupload to upload some images.

Before user can uploading images for a new gallery, the gallery name must be added. Since I’m using drag and drop, I need to abort the file upload if the gallery name i empty.

I’ve tried various solution, but I’m not able to stop the file upload (I think).

At the bottom in my SJ script, I’m doing a check on dragover. Where I want to abort is marked with //HERE FILE UPLOAD MUST ABORT.

But I’m not sure if this is the right place. Can anyone tell me where I can abort the upload on dragover (and drop)?

// PHP code - I'm adding this data here, because I need some WP data
function plupload_init() {

    //$image_size = get_option('sim_gallery_max_width_height');

    $plupload_arr = array(
        'runtimes' => 'html5,silverlight,flash,html4,browserplus,gears',
        'browse_button' => 'plupload-browse-button', // will be adjusted per uploader
        'container' => 'plupload-upload-ui', // will be adjusted per uploader
        'drop_element' => 'drag-drop-area', // will be adjusted per uploader
        'file_data_name' => 'async-upload', // will be adjusted per uploader
        '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' => __('Image files'), 'extensions' => 'jpg,jpeg,gif,png')),
        'multipart' => true,
        'urlstream_upload' => true,
        'multi_selection' => false, // will be added per uploader
        // additional post data to send to our ajax hook
        'multipart_params' => array(
            '_ajax_nonce' => "", // will be added per uploader
            'action' => 'plupload_action', // the ajax action name
            'imgid' => 0 // will be added per uploader
        )
    );
?>
    <script type="text/javascript">
        var plupload_config_vars = <?php echo json_encode($plupload_arr); ?>;
    </script>
<?php
}


// JS scrip
function init_image_upload() {

    if(jQuery('#image-upload').length == 0)
        return;

    var plupload_config = JSON.parse(JSON.stringify(plupload_config_vars));
    var uploader = new plupload.Uploader(plupload_config);

    // Control gallery name
    control_gallery_name();


    uploader.bind('Init', function(up){});

    uploader.init();

    // a file was added in the queue
    uploader.bind('FilesAdded', function(up, files){
    });

    // Change border color on drop zone
    function drop_area_visual_feedback(up) {
        var uploaddiv = jQuery('#plupload-upload-ui');

        if ( up.features.dragdrop) {
            uploaddiv.addClass('drag-drop');

            jQuery('#drag-drop-area').bind('dragover.wp-uploader', function(){ // dragenter doesn't fire right :(
                if(!jQuery('input[name="gallery-name"]').val()) {
                    jQuery('label.missing-name').removeClass('hidden');

                    //HERE FILE UPLOAD MUST ABORT

                } else {
                    uploaddiv.addClass('drag-over');
                }

            }).bind('dragleave.wp-uploader, drop.wp-uploader', function(){
                    uploaddiv.removeClass('drag-over');
            });
        } else {
            uploaddiv.removeClass('drag-drop');
            jQuery('#drag-drop-area').unbind('.wp-uploader');
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T02:41:21+00:00Added an answer on June 19, 2026 at 2:41 am

    Have you tried putting your code in the FilesAdded handler, like this ?

    // a file was added in the queue
    uploader.bind('FilesAdded', function(up, files){
           if(!jQuery('input[name="gallery-name"]').val()) {
                    jQuery('label.missing-name').removeClass('hidden');
                    up.splice(0);
            }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I am using JSon response to parse title,date content and thumbnail images and place
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm using an ASP request returning a XML file containing some latin characters. By
I am using jsonparser to parse data and images obtained from json response. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.