View Full Version : ondragover condition

08-26-2011, 07:29 PM
i have been searching the net to find a way to condition ondragover results by file type being dragged.

function doDragOver(event)
if(event.dataTransfer.types.contains('image/png')){ event.preventDefault(); }
if(event.dataTransfer.types.contains('image/gif')){ event.preventDefault(); }
if(event.dataTransfer.types.contains('image/jpg')){ event.preventDefault(); }
if(event.dataTransfer.types.contains('image/jpeg')){ event.preventDefault(); }
this is waht i have been trying based on the ondragover documentation on the MDN network.

i need preventDefault to be triggered if what i am dragging is an image from thee users hard drive and not triggered if the element is dragged from the browser. i can find no listing of type formats or even discovering file types for the dragged item on any network. I would greatly appreciate any help.
ps. i have been stuck on this for three days now, i may be losing my mind :)