Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 913
  • Last Modified:

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.
0
proteam4
Asked:
proteam4
2 Solutions
 
ZvonkoSystems 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
b0lsc0ttCommented:
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now