Posts

Showing posts from June, 2019

Wordpress - Upload multiple files using wp_handle_upload

Image
We are going to use Ajax and PHP to perform multiple file uploads in a wordpress plugin. jQuery Ajax code. To send files. $ ( "#button_id" ) . click ( function ( e ) { e . preventDefault ( ) ; var filedata = document . getElementById ( "inputGroupFiles" ) , formdata = false ; if ( window . FormData ) { formdata = new FormData ( ) ; } var len = filedata . files . length , img , reader , file ; for ( var i = 0 ; i < len ; i + + ) { file = filedata . files [ i ] ; if ( formdata ) { formdata . append ( "file[]" , file ) ; } } formdata . append ( 'action' , 'my_action_upload_logos' ) ; jQuery . ajax ( { url : '<?php echo admin_url(' admin - ajax . php '); ?>' , type : 'post' , contentType : false , processData : false , data : formdata

Tkinter menu button example

Below is Python Tkinter menu button and submenu example. from tkinter import * root = Tk ( ) def random ( ) : print ( "this is a statement" ) mainMenu = Menu ( root ) root . configure ( menu = mainMenu ) subMenu = Menu ( mainMenu ) mainMenu . add_cascade ( label = "File" , menu = subMenu ) subMenu . add_command ( label = "Random Func" , command = random ) subMenu . add_command ( label = "New File" , command = random ) subMenu . add_separator ( ) subMenu . add_command ( label = "Supercalarfragilistic" , command = random ) root . mainloop ( )