You cannot upload a file using XMLHttpRequest (aka. AJAX), which means
you cannot pass a file using $.getJSON().
Doing what you want to do requires a workaround for uploading files in
a AJAX-style manner through using iframes.
On your page you have an iframe somewhere, maybe 1x1px in size so it's
not easily viewable. Your form will submit normcally with a target to
this iframe to your php or aspx resource. With that, you parse the
content of the file (you have to do it server-side since Javascript
cannot read the contents of your file), and do what you want to do
with it, and output data back. Note that the data will be outputted
back to the iframe, so all you have to do is use Javascript to access
the iframe and read the content of it as your response.


On Mar 30, 7:42 am, StErMi <ste...@gmail.com> wrote:
> Hi all, i'm using jQuery to pass a file to a .php or .aspx page using
> $.getJSON() function.
>
> My problem is: how can i pass all the input file data to that page?
> Which attributes of the input file have i to pass?
>
> I think that i have to pass the name of the file ( and here ok, i can
> get it with .attr('value') ), than the real data of the file input,
> and this is the real problem couse i don't know how to retrive it...
> Can someone help me giving me some answer, hints or tutorials?

Reply via email to