Reputation: 5872
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?
Upvotes: 3
Views: 453
Reputation: 13812
$.ajax({
type: "POST",
url: "phpfile",
cache: false,
data: $('.thisInput').val(),
dataType: "script"
});
Upvotes: 1
Reputation: 12000
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.
Upvotes: 3