Reputation: 642
I am using javascript to upload file. for which i have used,
$("#file").on("change", function(event) {
var files = event.target.files;
var file = files[i];
file.type = "abcd"; // MY AIM
alert(file.type); // NOT returning "abcd"
}
It is giving alert as image/jpg, but i want to overwrite my variable for a some browsers which are returning wrong file types. Is there any way to do so? please help me
Upvotes: 2
Views: 279
Reputation: 1074138
You can't change type
, it's a read-only property. You'll just have to send supplementary information to your server telling it the correct type separately.
Upvotes: 4