AJAX File Upload?

I want to upload an image file through AJAX and sending to to new server side script, which actually resizing the image ans shwing resized image. Through normal file upload I can be able to do that but I want to do that with AJAX , so that I can show the resize image on a flow, without sending user to new url or script path.

Please tell me, if anyone knows the script which can help me to upload image files through AJAX, I knw in normal AJAX file upload cannot be possible, it will be using an iframe I think. I am thankful in advance if someone has the solution for this issue.

Thanks.
proteam4Asked:
Who is Participating?
 
ZvonkoConnect With a Mentor Systems architectCommented:
I am really astonished that it can work because my understanding was that file upload controls cannot be controled by script. And I did not know anoter way to get imiage file content data bytes to send them as information in background. But it seams the data island assingment can do that:
 // create a new node and set binary content
 var fileNode = xmlSOAP.selectSingleNode("//file");
 fileNode.dataType = "bin.base64";
 // open stream object and read source file
 if (adoStream.State != 1 )
 {
  adoStream.Type = 1;  // 1=adTypeBinary
  adoStream.Open();
  adoStream.LoadFromFile(this.filePath);
 }
 
Look here for the complete script:
http://www.codeproject.com/useritems/AJAXUpload.asp

0
 
Michel PlungjanIT ExpertCommented:
Hmm looking at the code there, it uses pretty heavy activeX which has to be accepted by the user
0
 
proteam4Author Commented:
Thanks for reply, but I want activeX free script for my PHP, I am using php as a server side scripting. can you help in with php?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
Michel PlungjanIT ExpertCommented:
I would think you need the file form element.
Then you can auto post it to a normal php file upload

http://www.webtoolkit.info/ajax-file-upload.html
0
 
proteam4Author Commented:
I need PHP + AJAX
0
 
siva_sivaCommented:
Go through following link in this they use PHP and AJAX to upload an image.

http://www.air4web.com/files/upload/
0
 
Michel PlungjanIT ExpertCommented:
Second link in the google I posted.
0
 
proteam4Author Commented:
thanks for these links, can you tell me, how do I pas varibles in src of an iframe. I want to pass like script.php?var1=value   but this is not happening..
0
 
Michel PlungjanIT ExpertCommented:
Not enough info.

If you use
script.php?var1=value
then in script.php you have
$var1 = $_GET["var1"];
0
 
Michel PlungjanIT ExpertCommented:
I would say split me {http:#19977112} and Zvonko {http:#19976913}
0
 
b0lsc0ttIT ManagerCommented:
mplungjan,

Thanks for the comment and recommendation.  I'll change mine.  As I looked at this again (after some sleep :] ) it seems the Asker said he was helped by those links.

    Changed recommendation:  Split - mplungjan {http:#19977112} and Zvonko {http:#19976913}

Let me know if there are any objections.

b0lsc0tt
EE Cleanup Volunteer
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.