Skip to content

Instantly share code, notes, and snippets.

@etdsoft
Created August 20, 2013 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etdsoft/6282552 to your computer and use it in GitHub Desktop.
Save etdsoft/6282552 to your computer and use it in GitHub Desktop.
Prompt for a file name when an image is pasted into the browser window (Chrome only)
// ... line 368
$('#fileupload').fileupload({
dropZone: $('#dropzone'),
headers: {
'X-CSRF-Token': csrf_token
},
destroy: function (e, data) {
data.headers = $(this).data('fileupload').options.headers;
$.blueimpUI.fileupload.prototype.options.destroy.call(this, e, data);
},
paste: function(e, data) {
$.each(data.files, function(index, file) {
if (!(file.name != null)) {
return file.name = prompt('Please provide a filename for the pasted image', 'screenshot-XX.png') || 'unnamed';
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment