Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Use an element to get a file dialog and upload instead of a file input element
<!DOCTYPE html>
<script src="//"></script>
input {
<form method="post" enctype="multipart/form-data">
<div id="wrapper" style="background-color:red;">click here to upload<br><br>
<input type="file">
var $fileUploadInputWrapper = $('<div/>').css( {height:0, width:0, 'overflow':'hidden'} );
// to use stopPropagation instead if statement use:
// $('#wrapper > :file').click(function(event) { event.stopPropagation(); });
if( !$(':file') ) {
$(':file').change( function() {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.