I have a form with a file input. How do I get the file and post it to a php script using jQuery? Can I just use .val() to get the value and then post this? For example say the file input has an id of file could i just do:
$('#submit').click(function() {
var file = $('#file').val();
$.post('script.php', { "file": file }, function(data) {
// do something here after post complete
}, 'json');
});
Thanks