Skip to content

Instantly share code, notes, and snippets.

@ggilder
Created October 21, 2011 13:06
Show Gist options
  • Save ggilder/1303804 to your computer and use it in GitHub Desktop.
Save ggilder/1303804 to your computer and use it in GitHub Desktop.
fake drag and drop file access in safari
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=Content-type content="text/html; charset=utf-8">
<title></title>
</head>
<body>
<form>
<input type="text" id="fileDrag" placeholder="Drag file here">
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>
$(function(){
setInterval(function(){
var path = $('#fileDrag').val();
$('#fileDrag').val('').blur();
if (path != '') {
$('body').append('<img src="file://' + path + '">');
}
}, 50);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment