Drag and Drop files to Panel For Upload

علی ذوالفقار
1402/04/17 14:35:22 (125)
$('#darganddrop_panel').on('dragover',function(e) {
        e.preventDefault();
        e.stopPropagation();
    }
);

$('#darganddrop_panel').on('dragenter',function(e) {
        e.preventDefault();
        e.stopPropagation();
    }
);

$('#darganddrop_panel').on('drop',function(e){
    console.log('Drop detected ' , e)
        if( e.originalEvent.dataTransfer && e.originalEvent.dataTransfer.files.length ) {
            e.preventDefault();
            e.stopPropagation();
            
            let files = e.originalEvent.dataTransfer.files; 
            upload_all_files(files);
            // or 
            // upload_all_files(e.originalEvent.dataTransfer.files);
        }
    }
);
Back