AJAX File upload

I am trying to code AJAX file upload option . I don’t want to mimic it for Ajax using iframe as most of the example online did , but I want a pure Ajax i.e. Zero page refresh . On server end I will handle the file with PHP as long as I can get following

$_FILES"file"]“tmp_name”];
$_FILES"file"]“name”] ;
$_FILES"file"]“type”];
$_FILES"file"]“size”];

So is there any way to post that binary data to my PHP page using pure Ajax ?

Re: AJAX File upload

*Ajax don't support file handling .....
You have to use iframe ..... but using combination of iframe with ajax your page won't be refreshed
*

Re: AJAX File upload

One solution I found is to encode binary file to Base64 and then POST it using AJAX . On server side just decode it and you can have whole binary array . But problem with this approach is size of file . As Base64 Encoding actually increases the size of data rather than decreasing .

Hey if you get a chance will you please post the code of ifram example. Thanks.

Re: AJAX File upload

**you wanna use jquery or plan ajax?

there are plenty of jquery plugins available for that

I don’t have “pre jquery world” ajax upload code anymore
for jquery I’ve used ajaxForm plugin
jQuery Form Plugin
jQuery Form Plugin
**

Re: AJAX File upload

I thought I could just use plain Ajax to make it work , but I think it is not possible . First I can't read file using JavaScript (only for IE you can) , which is a limitation . Second will be the file size problem .

I'll look into this JQuery thingy . But it is not Ajax , as it still reloads the page .

Thanks for the example .

Re: AJAX File upload

*Though it will call iframe ......but, It won't refresh page .... *