Anirudha Gupta
Anirudha Gupta

Reputation: 9289

how i can make ajax uploader for images?

I need to implement Ajax uploader for image on my website. means when someone upload image i show them without refresh.

don't thing it's impossible like most of blog have a process that when upload a image they open pop-up and when i upload pop-up are closed and image now can seen in old windows i have where i write weblog.

can someone show me example or source code to implement this

Upvotes: 2

Views: 516

Answers (3)

CharlesLeaf
CharlesLeaf

Reputation: 3201

Most common solution for 'ajax' uploads is actually very simple, namely a hidden iframe. As long as it's within the same domain, you can access the contents and parse the response from it just like you would any other request.

The new XMLHttpRequest, most commonly used within HTML5 applications, is actually capable of transmitting files as well. Right now it's not the most broadly supported method, but depending on your situation it might work as well.

Upvotes: 1

Vern
Vern

Reputation: 2413

you might want to check out:

http://pixeline.be/experiments/jqUploader/test.php

and

http://www.malsup.com/jquery/form/#code-samples

They are pretty neat :) Hope it helps! Cheers!

Upvotes: 2

Atticus
Atticus

Reputation: 6720

As far as I know.. you can't. This requires a multipart/form-data post and you may only do that with a form. You cannot transmit files asynchronously.

Ajax is an XmlHttpRequest, which does not contain files.

Upvotes: 0

Related Questions