Created
October 1, 2016 18:54
-
-
Save WebFikirleri/5e673428fcffbb673ef72de7743f84a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="form-group"> | |
<label for="resim1_d5">Resim<br></label> | |
<div class="input-group"> | |
<label class="input-group-btn"> | |
<span class="btn btn-primary"> | |
<i class="glyphicon glyphicon-file"></i> Dosya Seç… <input type="file" style="display: none;" name="resim1_d5" id="resim1_d5"> | |
</span> | |
</label> | |
<input type="text" class="form-control" name="resim1_d5" value="<?=$dt->resim1_d5?>" readonly> | |
</div> | |
</div> | |
<script type="text/javascript"> | |
$(function() { | |
// We can attach the `fileselect` event to all file inputs on the page | |
$(document).on('change', ':file', function() { | |
var input = $(this), | |
numFiles = input.get(0).files ? input.get(0).files.length : 1, | |
label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); | |
input.trigger('fileselect', [numFiles, label]); | |
}); | |
// We can watch for our custom `fileselect` event like this | |
$(document).ready( function() { | |
$(':file').on('fileselect', function(event, numFiles, label) { | |
var input = $(this).parents('.input-group').find(':text'), | |
log = numFiles > 1 ? numFiles + ' files selected' : label; | |
if( input.length ) { | |
input.val(log); | |
} else { | |
if( log ) alert(log); | |
} | |
}); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment