I know that it is possible to upload files using drag and drop with the HTML5 File API. Can this also be done by copying a file from the file explorer and paste it into a web page using CTRL-V/CMD-V or by pasting from the right click context menu?
Tip: To quickly create a new blank file or email, press Ctrl+N.
You can add keyboard shortcuts to your page through HTML with the global accesskey attribute and trigger it with Alt + Shift + key in Chrome and Firefox on Windows, or use Control + Alt + key on Mac.
Ctrl + A → Select all content. Ctrl + Z → Undo an action. Ctrl + Y → Redo an action. Ctrl + D → Delete the selected item and move it to the Recycle Bin.
You can't do that.
You can get the file path easily with this :
$(document).on('paste',function(e){
var path = e.originalEvent.clipboardData.getData("text");
});
So you may show it to the user.
But you can't change yourself the value of an <input type=file>
.
That's a security measure : imagine if your script could change the path of the file to be uploaded just before the user submits the form (or even without user interaction as is now possible with other form elements) ? As for every important security protection, there is no known "workaround" for modern browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With