I have some elements like these:
<input type="file" name="fake">
<input type="file" name="real" style="display:hidden;">
<a href="javascript:void(0)" onclick="addToList开发者_运维知识库()">
<input type="submit" name="submit" value="Submit">
My question is : is it possible to assign the value of the "fake" input to "real" input by using jquery? So that when I hit Submit button, the "real" file input will be uploaded.
addToList = function(){
//what should I do here to assign the "real" file input value
}
My understanding is that generally you won't be able to assign a file to a file input element-- this is a security restriction so that you can't programmatically grab random files off of someone's disk.
I'm not sure what you are trying to accomplish, but there is some newer HTML5 capabilities that might help documented here.
精彩评论