How to get the "value" of a upload input with jQuery
I know that this sends stuff to a php file and gets stuff returned from the php file as javascript:
$.ajax(开发者_高级运维{
type: "POST",
url: "phpfile",
cache: false,
data: datahere,
dataType: "script"
});
But... suppose "datahere" is a file from a input file element. How am I supposed to get the value or data from that upload input file element?
Take a look at these plugins: 7 trusted ajax file upload plugins using jquery
Those are some AJAX file upload plugins. They might be what you need.
$.ajax({
type: "POST",
url: "phpfile",
cache: false,
data: $('.thisInput').val(),
dataType: "script"
});
精彩评论