Hello,
I would like to upload a file using AJAX and jquery.
I have a regular <input type="file" id="file"> to choose my file.
and this jquery ajax request:
PHP Code:
$(document).ready(function(){ $('#toevoegen').click(function(){ bestandje = $("input#file").val(); $.ajax({ type: "POST", url: "afbeeldingen.php", data: "file="+bestandje, success: function(html){ $("#results").append(html);
} }); }); });
I am not sure if the above is the correct way. But i don't know how to "catch" the file in my ajax php. Normally i would use $_FILES['file']['name'] but that does not work this way. Any ideas?
thanks!
Matt
Last edited by killerwhale65; 05-06-2009 at 11:13 AM..
|