How to use jQuery’s drop event to upload files dragged from the desktop?

It’s a little messy (you need to handle at least 3 events) but possible. First, you need to add eventhandlers for dragover and dragenter and prevent the default actions for these events like that: $(‘#div’).on( ‘dragover’, function(e) { e.preventDefault(); e.stopPropagation(); } ) $(‘#div’).on( ‘dragenter’, function(e) { e.preventDefault(); e.stopPropagation(); } ) It’s actually important to call … Read more

Preventing click event with jQuery drag and drop

A solution that worked well for me and that doesn’t require a timeout: (yes I’m a bit pedantic 😉 I add a marker class to the element when dragging starts, e.g. ‘noclick’. When the element is dropped, the click event is triggered — more precisely if dragging ends, actually it doesn’t have to be dropped … Read more

Basic Drag and Drop in iOS

Assume you have a UIView scene with a background image and many vehicles, you may define each new vehicle as a UIButton (UIImageView will probably work too): UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button addTarget:self action:@selector(imageTouch:withEvent:) forControlEvents:UIControlEventTouchDown]; [button addTarget:self action:@selector(imageMoved:withEvent:) forControlEvents:UIControlEventTouchDragInside]; [button setImage:[UIImage imageNamed:@”vehicle.png”] forState:UIControlStateNormal]; [self.view addSubview:button]; Then you may move the vehicle wherever you want, … Read more

Does HTML5 allow drag-drop upload of folders or a folder tree?

It’s now possible, thanks to Chrome >= 21. function traverseFileTree(item, path) { path = path || “”; if (item.isFile) { // Get file item.file(function(file) { console.log(“File:”, path + file.name); }); } else if (item.isDirectory) { // Get folder contents var dirReader = item.createReader(); dirReader.readEntries(function(entries) { for (var i=0; i<entries.length; i++) { traverseFileTree(entries[i], path + item.name … Read more

Drop event not firing in chrome

In order to have the drop event occur on a div element, you must cancel the ondragenter and ondragover events. Using jquery and your code provided… $(‘.drop’).on(‘drop dragdrop’,function(){ alert(‘dropped’); }); $(‘.drop’).on(‘dragenter’,function(event){ event.preventDefault(); $(this).html(‘drop now’).css(‘background’,’blue’); }) $(‘.drop’).on(‘dragleave’,function(){ $(this).html(‘drop here’).css(‘background’,’red’); }) $(‘.drop’).on(‘dragover’,function(event){ event.preventDefault(); }) For more information, check out the MDN page.

Drag and drop files into WPF

This is basically what you want to do. private void ImagePanel_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { // Note that you can have more than one file. string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); // Assuming you have one file that you care about, pass it off to whatever // handling code you have defined. HandleFileOpen(files[0]); } … Read more

Make WPF window draggable, no matter what element is clicked

Sure, apply the following MouseDown event of your Window private void Window_MouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) this.DragMove(); } This will allow users to drag the Window when they click/drag on any control, EXCEPT for controls which eat the MouseDown event (e.Handled = true) You can use PreviewMouseDown instead of MouseDown, but … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)