Skip to main content
deleted 28 characters in body
Source Link
guest271314
  • 1
  • 15
  • 120
  • 189

What I want to do is to check the actual file type

Try accessing files[0].type property . See Using files from web applications

$("#imageLoader"":file").on("change", function(e) {    var file = e.target.files[0]; console.log(filethis.files[0].type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

What I want to do is to check the actual file type

Try accessing files[0].type property . See Using files from web applications

$("#imageLoader").on("change", function(e) {    var file = e.target.files[0]; console.log(file.type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

What I want to do is to check the actual file type

Try accessing files[0].type property . See Using files from web applications

$(":file").on("change", function(e) { console.log(this.files[0].type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

added 129 characters in body
Source Link
guest271314
  • 1
  • 15
  • 120
  • 189

What I want to do is to check the actual file type

Try checkingaccessing file[0]files[0].type property . See Using files from web applications

$("#imageLoader").on("change", function(e) { var file = e.target.files[0]; console.log(file.type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

Try checking file[0].type property

$("#imageLoader").on("change", function(e) { var file = e.target.files[0]; console.log(file.type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

What I want to do is to check the actual file type

Try accessing files[0].type property . See Using files from web applications

$("#imageLoader").on("change", function(e) { var file = e.target.files[0]; console.log(file.type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />

Source Link
guest271314
  • 1
  • 15
  • 120
  • 189

Try checking file[0].type property

$("#imageLoader").on("change", function(e) { var file = e.target.files[0]; console.log(file.type); })
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <input type='file' id='imageLoader' name='imageLoader' accept="image/*" data-type='image' />